How to use "jmp" in ROP I'm trying to put together a ROP chain.  I'm looking for a gadget to do the following:

mov rdi, rdx ; mov rbp, rsp ; ret;

But instead, I have a gadget like this :

mov rdi, rdx ; mov rbp, rsp ; jmp 0x8109b3f7

So, I thought maybe I can use this gadget, all I have to do is pointing this jmp address ( 0x8109b3f7) to the next gadget address. But this is not working. I use GDB to set the jmp address like the following:

set *0x8109b3f7=0xgadget_address

It still points to the jmp address, not to the gadget address. Any help how can I do that?

N.B: I'm using x86-64 architecture.

Using jmp may not result in a ROP friendly return of control to your stack. You're better off finding alternate gadgets to achieve your goal.

Also for your proposed solution if your exploit is able to modify the opcodes at 0x8109b3f7 you already have code execution and no need for further ROP.


Do malicious files on old hard drives pose a risk? Lets say that I buy a used hard drive on which an attacker has placed malicious files.  Might these somehow pose a danger to my machine, e.g. via some other vulnerability such as buffer overflow causing a program to read from arbitrary locations on disk?

I'm no security researcher, but it intuitively worries me to just plug in a hard drive when I have no idea what's on it.

Untrusted hard drives are potentially dangerous. You should make sure to format it (don't forget that there might be more than one partition) before you boot from it. If you want to be extra careful, you could disconnect your old hard drive, boot from a pen drive and format it from there. That way, there is minimal contact.

There are advanced malware that survives formatting by hiding in the firmware. However, it's not likely some random virus the previous owner contracted would have that capability. This would be a more advanced, targeted attack, and not something I would say the normal consumer needs to worry about.


Can data be decrypted with the public key if encrypted with the private key? I am trying to understand the principles of asymmetric encryption, and have read the following in a book:

  One key is completely public and can be read and used by everyone. The
  other part is private and should never be shared with someone else.
  When you encrypt something with the public key, it can be decrypted by
  using the private key, and vice versa.

Looks like the public key is not secret. But if I encrypt with the private key, someone can decrypt with the public key which is easily accessible. Where's the logic in that?

Looks like public key is not secret. But if I encrypt with private, someone can decrypt with public which is easy accessible. Where is logic?

So let's go the public encrypt -> private decrypt route.  You're seemingly already aware of the use case of this.  Users are able to encrypt things with your public key, that only your private key can decrypt.  This is useful for when say a user on the internet wants to send a message that only you, as the owner of the private key, can decrypt.

This is all well and good, but what purpose does the other direction serve (encrypt w/ private -> decrypt w/ public)?  The answer is, you can help assure that you are a owner of the private key to a corresponding public key when you encrypt a message with your private key, and the public key is able to successfully decrypt and verify the message.  This is the basic idea around Signature Generation and verification.


Is it possible to mitigate risks of using a wifi connection that uses a self-signed security certificate? I don't really know anything about security certificates, and I tried reading about this, but couldn't find the answer.

Edit: The hotel I'm staying in uses a login page for the wifi connection that uses a self-signed security certificate. I'm hesitant to connect my laptop to it because of this. My wlan card isn't attached to the host machine, but rather a VM within it. The internet connection is passed to another VM that implements a firewall (from archlinux wiki on "Simple Stateful Firewall" page), which is then passed to a VM that handles my VPN connection, then to other VMs that actually use the connection for whatever. Would it be safe to use this wifi connection?

Summary:

A wifi network with a badly-configured CA certificate (or a CA certificate that they only give to employees) is no worse than an open network with no certificate.

Would you still connect if it was an open wifi? If yes, then don't worry about it.

I'm assuming you're talking about the certificate that the wifi presents during connection? Something like this?

My understanding is that this exists to prevent SSID spoofing (ie an attacker parks a van outside your house and broadcasts a network with the same SSID as yours). When you connect to a wifi network, it can present you a certificate that cryptographically proves that it is the network that it claims to be (provided that you trust the Certificate Authority that issued that cert -- hence the UI thing about whether you trust the CA).

Would you trust it if it was an open network?

It sounds like the hotel configured this with a self-signed certificate. Maybe that's so hotel employees, or hotel equipment can download the CA cert and be sure nobody is doing an SSID Spoofing attack on them.

To you as a hotel guest, a mangled wifi certificate config is no more dangerous than a wifi with no CA certificate. So the question to ask yourself is:

Would you still connect if it had been an open network with no certificate?

If the answer is Yes, then don't worry about it. If the answer is No, then you probably know something about this network and what cert it should be displaying, and wouldn't be asking this question in the first place.

Note: this is different from installing a root CA cert into your OS or browser

One last note: We are talking about trusting a CA to identify the SSID during wifi connection. Note that this is different than trusting a CA to identify a website in your browser. If they ask you to download a CA cert and install it into your operating system, that would be a red-flag, because now they can impersonate any website that you try to connect to.


Famous XSS attacks over JavaScript I'm about to graduate in "Computer Science", and I'm writing  thesis about the Javascript vulnerabilities. In particular, I'm analyzing the JS vulnerabilities that allow XSS attacks.

I would like to report in a specific chapter some famous attack which exploited JS vulnerabilities. Does anyone know the existence of such attacks occurred in recent history?

The most famous has got to be the Samy worm:

  Samy (also known as JS.Spacehero) is a XSS worm that was designed to
  propagate across the MySpace social-networking site written by Samy
  Kamkar. Within just 20 hours of its October 4, 2005 release, over
  one million users had run the payload making Samy the fastest
  spreading virus of all time.

  The worm itself was relatively harmless, it carried a payload that
  would display the string "but most of all, samy is my hero" on a
  victim's MySpace profile page. When a user viewed that profile page,
  the payload would then be replicated and planted on their own profile
  page continuing the distribution of the worm. MySpace has since
  secured its site against the vulnerability, however certain MySpace
  profiles still display evidence of the worm to this day.

There was also xssed which keeps a record of real exploits, however it appears to no longer be maintained.


How to retrieve a particular row from database vulnerable to SQL Injection? When I put Username:anything and Password : 1'or'1'='1, my database retrieves the first row from MYSQL table. How do I  retrieve the row corresponding to Username:anything? This is for a project in which I need to show all possible SQL vulnerabilities and rectify them.

Basically the sql would look like this:

select * from table
where username='anything' and pw='1' or '1'='1'

We know that 'and' has precedence over 'or' so:

 select * from table
    where (username='anything' and pw='1') or '1'='1'

So if the 'anything''s password is not '1' you will get the first row since '1'='1' is always true

UPDATE:
To get the result you want you have to change username value and so for password, I'm not sure but this is nearly the values you should inject:
username='anything ('
pw=1') or '1'='1'


Is it possible make a Pass-The-Hash attack with Responder? The tool Responder written in Python permits to listen on a specific network card requests and automatically poisoning victims the steal hash NTLMv1 and hash NTLMv2.
The attack Pass-The-Hash permits to connect to a service like SMB.
I am a little bit confused about difference between hash LM and hash NTLM and so the consequences of a Pass-The-Hash attack.
I know that it's also possible to crack the hash NTLMv1 or NTLMv2 with John for example.
From the premise that password is complex and it's not possible to brute-force it, apart connect to a share and get some sensitive files :

What can do an attacker on the same network ?
Is it possible to forge connect to RDP service for example ?
Is it possible to forge a sliver/gold Kerberos ticket ?

Responder gathers NetNTLMv1 and NetNTLMv2 hashes, to be precise. These hashes are generated as part of a challenge-response mechanism, and as a result in much harder to crack than LM or NTLM hashes, which are based on a not-so-strong encryption algorithm.

An attacker running Responder inside a network can use a tool such as NTLMRelayx from impacket to relay the credentials to any SMB server which has SMB Signing disabled. Note that the attacker cannot relay these credentials back to the service on the same system from where the hashes were captured.

Although an attacker cannot RDP to a server using relaying, they should still be able to gain administrative access to the server through SMB (provided the credentials relayed belonged to a privileged user)

No, an attacker cannot forge golden/silver ticket using just the NetNTLMvx hashes.


Why is Google using Local File Inclusion and Directory Traversal attempts on my site If have a firewall on my wordpress site and it has blocked Google from attempting both Local File Inclusion and Directory Traversal attempts. Why would Google be doing this?

  United States Mountain View, United States was blocked by firewall for
  Directory Traversal in query string:
  filename=..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd%2Chttp%3A%2F%2Fwww.MySite.com%2Fwp%2F…
  at
  http://www.MySite.com/wp//wp-content/plugins/wp-symposium/server/php/index.php,http://www.MySite.com/wp//wp-content/plugins/w…
  14/10/2017 12:43:15 (20 hours 39 mins ago)   IP: 66.249.73.207 [block]
  Browser: undefined Mozilla/5.0 (compatible; Googlebot/2.1;
  +ttp://www.google.com/bot.html)

  United States Mountain View, United States was blocked by firewall for
  LFI: Local File Inclusion in query string: filepath=%2Fetc%2Fpasswd at
  ttp://www.MySite.com/wp//wp-content/plugins/simple-image-manipulator/controller/download.php?filepath=%2Fetc%2Fpasswd
  14/10/2017 12:43:09 (20 hours 39 mins ago)   IP: 66.249.73.207 [block]
  Browser: undefined Mozilla/5.0 (compatible; Googlebot/2.1;
  +ttp://www.google.com/bot.html)

It might be that somebody is including these links into his page for the Google bot to notice and follow. If you then block the IP address since it looks like attacks you will block the Google bot from indexing your site. And maybe this is what this somebody wants to achieve, i.e. make your site harder to find. It could be a competitor using Blackhat SEO methods or just somebody who does not like you. Another possibility is that this somebody later checks the Google index for the seeded URLs to find out if the Google bot found some interesting content there.

See also Google Bots Doing SQL Injection Attacks from 2013 for a similar problem.


Is there any way to scan a host with nmap without arp respond? I have a security device that it doesn't respond to icmp and arp request.
but i know its MAC address.
I want to scan the device with nmap but always says "host down" and does not start port scan (even with -Pn). Also i defined i new arp record for the device but it didn't helped.

Nmap by default performs ARP scan at the discovery stage but if you want to disable it explicitly then you have to specify --disable-arp-ping. As you said that You have specified -Pn then it's for sure that port scanning will be done and Host is up should be reported.

Please also tell your Nmap's version so that we can help you even more.


How to find the ip address of a wifi router while I have it's MAC address? I have a wifi scanner which shows me the MAC addresses of the wifi routers nearby.

It displays SSIDs in one column and MAC addresses in another column.

I want to know the ip address of the router. what should I do?

WLAN is in the OSI-Model at layer 2 while IP is at layer 3. You need to first have full access to the layer 2 before you can get the information from layer 3. This means that for a WLAN without encryption you can probably see the information by using wireshark, but for a WLAN with encryption you need to decrypt the data first because the encryption is at layer 2. According to the documentation wireshark is able to decrypt WEP and WPA/WPA2 traffic in pre-shared mode if the passphrase is known.


Would it be possible to create an external mac address spoofer? I was wondering if it would be possible to create some sort of ethernet passthrough device, but this device also functions as a layer 2 mac address spoofer, which can be used with any device without the need for a software mac address spoofer, or for devices which are incapable of changing their mac address  normally i.e. a router/access point. This would allow for someone to set up a rogue access point that shows up to the network as an iphone.
there are research articles which refer to an FPGA being used for interpreting ip communications on layer 2, and I want to know if you could manipulate the ethernet frame of a packet, to make a layer 2 mac address spoofer, or even a device to replay packets
and finally i was wondering if a device like this actually exists as well. has this idea been come up with before? has it been made or proven wrong?

This is called a layer 3 bridge. It can be done with common hardware and a common OS like Linux. All what it is needed is a hardware with two network cards and to configure the OS as a layer 3 bridge. The outgoing data from the bridge in the direction of the rest of the network will have the MAC of the bridge's network interface and not the original MAC.
Note that care must be taken to rewrite the MAC not only inside the IP packets but also in payloads which connect layer 2 with layer 3, i.e. within ARP. See for example Bridging Network Connections with Proxy ARP.


Running arp command on public wifi network I accidentally ran this arp -a on a public wifi network(because it is in my terminal history). I killed the process almost immediately. I want to know if this would raise an alert for the network administrator as I do not want any trouble. Will this be considered as arp spoofing? Will this be regarded as a malicious attempt?

You have nothing to worry about. The arp -a command you ran would simply list the ARP cache tables on your local machine's interface(s) as explained on Microsoft's documentation site.

In order for your machine to communicate with other hosts on the same, internal network, MAC addresses are needed. Each interface should have an IP and MAC address. An ARP table is used to convert a machine's IP to its MAC address.

ARP Spoofing would require a bit more work to do, and by just running arp -a you are not sending anything onto the network that would put you into trouble.


Is ssh and public key scheme like ed25519 as safe as the hackability of your computer? I am just learning Linux and I have setup ssh to connect to a server. To do that I need to generate the key for the ed25519 public-key scheme. Once generated, both the public key and the private key are stored in .ssh.

Therefore, if someone can hack into my computer and get access to the .ssh folder then basically the security offered by this ssh+public-key is hacked. My last defence is the fact that I have encrypted my private key using a passphrase.

Is my understanding correct?

Public key cryptography in conjunction with SSH provides  a way better identity checking  than password authentication. An entity must possess both the private key and the correct passphrase to authenticate itself to another entity. You don't have to store you private key on the server. For example, when you create a pub/priv key pair with for example PuTTgen you keep the private key private and upload only the public key to ~/.ssh/authorized_keys. So if someone gets in the possession of you private key, then yes, nothing can stop him/her to access your server. However if you set a passphrase on your private key then the private key is further encrypted using a symmetric encryption key derived from  that passphrase. Oh and when someone can hack your computer then you have much bigger problems than worrying about him/her gainging access to your .ssh directory. But in general the answer to your question  My last defense is the fact that I have encrypted my private key usinga passphrase. is yes.


Staying safe, but still connected, at security conferences If one is to spend some time away from home and work in a hotel environment where neighboring users can at least be presumed to be mischievous (if not actually malicious), what are some measures that can be taken to stay safe from said users while still staying connected?

Available resources:

Spare laptop
Spare Windows license
Work-provided VPN
Personal "dumb" cell phone (not dumb as a rock, but it's not going to MIT any time soon)
Work smartphone
Various forms of removable media (USB HDD, DVD-R, Flash Drive, MicroSD, etc.)

Planned activities:

Web browsing
E-mail
Social networking
Online gaming
Personal & work calls & SMS.
Remote access (RDP w/ NLA) to personal & work computers.

I plan on leaving my "daily driver" personal laptop at home, and might consider going without the smartphone if I can get away with it.  I'd like to be able to perform the above activities within a reasonable level of comfort, while ensuring that any data I handle (including my login credentials) stays confidential.  Also, of course, I'd like make sure no malware finds its way into my systems - at least, not through anyone's fault but my own.

It probably should be noted that I'm currently a native Windows user, with little to no experience in other OS's.

There's no reason to use Linux instead of Windows under the premise that one is 'more secure' than the other (this is not a simple query to answer).

Software

If the Laptop you have is running Windows then it's OK to stick with it, just do the following:

Make sure it is fully updated with the latest patches
Enable and configure Windows Firewall
Disable any extra services you don't need (if running an FTP server, etc.)

This won't make you 'unhackable', but nothing will. Choosing Linux over Windows is a fairly arbitrary choice, neither OS will protect you from 0day exploits.

Network

You say you have a company VPN? Assuming it is encrypted this is ideal for this situation. Configure your system to only send network traffic over your VPN.

Assuming this is encrypted then your credentials should be relatively safe.


How does the meet in the middle attack work on double DES? I am having trouble understanding the meet in the middle attack and how it works on double DES.

I understand that on single DES the key length is 2^56 but why when using double DES is it 2^57? Can someone explain it in simple terms please?

There is a concept of effective/actual key strength. For Double DES the effective key strength is 2^57 even though double DES uses 2^112 keys. The below example will make it clear.

Assume that you are a cryptanalyst who has access to the plain text and encrypted text. Your aim is to recover the secret key. Assume AAA (plaintext) -> XXX (After 1st encryption) -> ZZZ (after 2nd encryption).

You start with AAA and try all the 2^56 combinations for secret key by encrypting AAA. This will give you a big list of possible values for XXX.
Next you take ZZZ and try all the 2^56 combinations for secret key by decrypting ZZZ. This will give you a big list of possible values for XXX.

The amount of effort you have put in 2^56 + 2^56 = 2^57.

Now do a simple lookup between the two lists to find a matching value. As soon you see a matching value XXX in both the lists, you have found out the secret key. So this means that with effort of 2^57 keys you have broken the encryption.


Cheap door logging for home? Does someone here knows a cheap DIY door logging system?

What I have:
 - 2 doors that needs to be logged
 - 1 netbook (running OpenBSD with internet connection & root permissions), the two doors are 1 and 4 meters away from it.

What I need:
 - Every time when one of the door open/closes I need a warning about that (via e-mail) (e-mail must be sent in a few seconds after door opened/closed)

Extra:
 - When there is something moving or one of the door opens/closes an infra cam (to be exact I need 2 infra CAM) needs to take video (in good quality) about it (or at least pictures in good quality) and upload it to a place what I can reach via FTPS (the place where I upload isn't at home, where I need this monitoring/logging - So I alredy has a place where I can upload thing through FTPS).
 - When there isn't any power, the netbook could run fine (because it has a battery), that's ok. But how can I give power to the infra cam's?

Question: How to do this? Or where to ask for this?

*I need e-mail notification because I have an Android phone and this way I don't need to pay for SMS via phone, etc. That would be enough.

There are these kind of systems off the shelf for horrible $. But I want to do this from a lower budget. :) (as many people who want a little more security at home too here in the forum :) )

You could first have a look at Grabmotion - a freeware application which uses a webcam as a motion detector that can then email you pictures of whatever triggered it.

It's not connected to the door, but if you had the door in it's sensor range, it could work just as well.

Grabmotion isn't the only one - google will show you many free ones - but it seems closest to what you want straight out of the box.


Can hashing a file alter the file? Is a hash function a Random Oracle(RO) function or will there be a chance that the hash function will alter the file (as part of function or by accident) that it is hashing?

A hash function works on data, i.e. input and output data. If the data come from a file or network or similar and if they get written to a file or somewhere else has nothing to do with the hash function itself but with a program which uses this hash function for a particular purpose. This purpose can be be to only print the resulting hash value to stdout without modifying the input file. But a hash function can also be used in the process of adding a signature to some section of a file, in which case the file gets modified.


What kinds of SSL certificates are usable for encryption? I know that Verizon SSL certificates cost close to $600.
There are couple of cheap alternatives, but I never really understood why Verizon does not offer such certificates. Look for RapidSSL at nameCheap. They don't say anything about encryption for the $20 plan.

Assuming the above does not provide encryption: Does manually generating an SSL certificate provide mutual encryption?

I see couple of questions on SSL certificates, but looks like none of them answers my question:

Does an established SSL connection mean a line is really secure?
Does it matter which Certificate Authority I source my SSL Certificate from?

Avid's answer to the first question sounded a little complicated for me for who has no background on SSL certificates.

Certificates do not provide encryption. Encryption comes from SSL itself. The certificate is about convincing the client that the data it dutifully encrypts is really sent to the genuine intended server, and not somebody else impersonating the server. A certificate for a SSL server can use a key which works only for digital signatures (e.g. a DSA key) and the data will still be encrypted.

The price of a certificate, from a commercial CA, is driven by the following tendencies:

The CA is supposed to perform more or less thorough checks on the identity of who buys the certificate. That's the whole and only point of the CA: to link a "physical identity" with a public key. Such verifications imply human labour, and that can be expensive.
The CA has insurances. When you buy the certificate, the CA becomes liable for security trouble which may emerge from the CA not following the intended verification procedures, as defined in their "certification policy statement". In short words, when you buy a more expensive certificate, you get the right to sue them for more money.
Commercial CA will charge you as much as possible. If a CA sells you a 600$ certificate, then this means that they estimated that they would lose too many sells if the price was 650$. The commercial value of a certificate comes from the fact that the CA root key is already known to the SSL client's browser; for Windows / Internet Explorer, the default list of known CA is managed by Microsoft, and they will not include just any CA. Consequently, the CA market is not totally open, and competition fails to lower prices. Right now, SSL certificates tend to be overpriced. For instance, this allowed Thawte founder Mark Shuttleworth to buy a trip into space and then create and fund the Ubuntu Linux distribution -- so one can assume that commercial CA make quite a lot of profit out of each sold certificate.

You can create your own certificates (OpenSSL is a free tool that can do that, for instance; see EJBCA for something with a nicer interface); homemade certificates are often self-signed (in a certificate, there must be a signature from the issuing CA; the format does not allow omitting that signature field; so it is customary to have the certificate "sign itself" in the case of a stand-alone CA-less certificate). The practical consequence of a homemade certificate is that Web browser will display some scary warnings when they encounter them the first time (but users are quite good at ignoring warnings -- which, by the way, is also a problem, generally speaking).


Port 88 forwarding for offsite users to authenticate with DC So after researching, I decided to do some port forwarding on port 88 from offsite Mikrotik routers using public IP address x.x.x.x to port 88 in the main office, so users can authenticate with the domain controller for interactive logon.

If port forwarding is done from port 88 using specific real IP x.x.x.x (field office 1) to port 88 real IP y.y.y.y (main office) the offsite user then should be able to authenticate for credentials.

My concern is how far this setup can be vulnerable to attacks?

You should never expose authentication server onto the internet.
It is safer to expose the VPN server and then make users connect to VPN first to your office network.
You can connect your two networks via VPN as well.
Use well proven, secure VPN appliance, there are some cheap software ones like OpenVPN.

VPNs are also prime target for hackers. Therefore it's good to have limited number of networks which can access your VPN (firewall), keep it always up to date, do not allow to connect without user certificate (so you need issue for each user SSL cert, this way brute force wont work on VPN), enforce good AV software for each client accessing it.

Regarding exposing SSL for the VPN, note that there used to be numerous SSL exploits, so having  user certs, firewall and updates is really important.

Users should be able to logon to Windows using domain credentials offline (without VPN), then logon to VPN and proceed with launching Outlook and using Active Directory and stuff.


PCI compliant RSA key generation and getting value of private exponent Is it possible to generate RSA key and get its private exponent in clear and to be compliant with the following PCI requirement?:

Keys must be generated so that it is not feasible to determine that certain keys are more probable than other keys from the set of all possible keys. Cryptographic keys or key components must be generated by one of the following:

An approved key-generation function of a PCI–approved HSM
An approved key-generation function of a FIPS 140-2 Level 3 (or
higher) HSM
An approved random number generator that has been certified by an
independent laboratory to comply with NIST SP800-22

For example by importing AES key onto FIPS 140-2 Level 3 compliant token, generating RSA key pair on it and wrap its private part to PKCS#8 with imported AES key? Then decrypt private key with AES key on trusted desktop computer.

Your question asks that the RSA key pair be created on a token. If that token contains an approved RNG, you should be OK. Otherwise, not so good.

Your private key encrypted with an AES key will be imported onto a trusted desktop computer? Your private key should only be used for signing or for decryption. If your private key is for application signing it will likely be on a token. If used for decryption as part of a PKI within a P2PE solution, it should be on a SCD (HSM, KLD, POI).

You're not supposed to be able to get the keys in the clear within P2PE. The following is from 6F-1.1 of the P2PE draft version 2.0. Keys can only exist in one of the following forms:

• At least two separate key shares or full-length components

• Encrypted with a key of equal or greater strength as delineated in Annex C

• Contained within a secure cryptographic device

Note for hybrid decryption solutions: Clear-text Data Decryption Keys (DDKs) may temporarily be retained by the Host System in volatile memory for the purpose of
decrypting account data.


Is it possible to generate valid track 1 and track 2 data from basic CC info? We are working on a local security program and need some help. Is it possible to generate valid track 1 and track 2 information contained on your magstripe from your basic CC info?

Basic CC info includes:

First Name
Last Name
CC number
Exp Date
CVV code

Explicitly not.

The whole1 concept of magstripe data on the card is to prove that the card was present at the time of the transaction.  If you were able to reconstruct it without the card, that would defeat the purpose. Likewise, that's why PCI rules require you to never store the full swipe data (so you can't replay it later). 2

If you look at what's in the swipe, you'll see that both the Service Code and the Discretionary Data fields are not printed on the card anywhere.  Service codes are standardized, but there's no way to know ahead of time (i.e. without swiping) what it will be. Discretionary data is unique to each issuing bank, but usually contains information such as the CVV1 (which is not what's printed on the card), an encrypted PIN (for ATM use), and other distinguishing data.  The discretionary data is also different between the two tracks.

Basically, there is no way for anyone except the issuing bank to know whether correctly-formatted swipe data is actually valid or not, but there's no way to fake it to the bank, either.

1: This isn't quite true: It's also for speed and automation.

2: The rules also prohibit storing the CVV.


Process Hollowing and Kernel I still do not fully understand how process hollowing works.
I know how to do it and understand every step in using it.

But why does the system still see the process as the "host" process and not the target process at the end, even if we change in the code the PEB to the PEB of the target process?

Does the kernel save it somewhere?

That would most likely be the Virtual address descriptor (VAD).  More information about Process Hollowing techniques can be found at https://cysinfo.com/detecting-deceptive-hollowing-techniques/


Installing profile on "Good" Mail application give someone admin permission on my iPhone My new enterprise use the app "GOOD" for the emails.
But to use it, I have to install a GOOD profile with description : "Install this profile to enroll to encrypted profile service". If I choose "Install", I'll get this warning (translated in english by me, sorry for the errors...) :

Installing this profile, will allow the administrator of "https://www.good.com/cerebus/mdm" to manage your iPhone remotly.
The administrator will be able to collect personal informations, add or remove accounts or restrictions, list your installed apps and manage them, and erase the data of your iPhone remotly

Because it's my private phone, I'm afraid to see this kind of warning... I should be the only one who has the right to erase my phone or manage things that aren't related to the Good App...

Can anyone tell me if there is a risk to have my datas collected or modified by another person and if it's really safe to install it ?

This is a pretty standard message associated with MDM's and commonly seen with Bring Your Own Device (BYOD) plans.

The reason you're seeing this message and your company requires you to hook your phone up to the Mobile Device Management software is because they don't want unprotected company assets. This means if you leave the organization or go rogue, they want the ability to remove company property from your phone. Almost all modern MDM's allow for "select wipe" which will only remove content that has been pushed from your MDM profile, however it should be noted that an administrator of an MDM can remotely wipe your entire device should they see fit or make a mistake.

Safe is a relative term - the question you should be asking yourself is "Do you trust Good?" and "Do you trust the person who administers the server?" There is always an inherit risk with data collection anytime you connect any device to the internet, that risk doesn't just exist within MDM software.


Hash and data modification If I have the MD5 and SHA1 hash matches for an encrypted container. Is there no possibility it's been modified?

Is it safe to assume the container has never been modified?

It is never zero, there is always a probability that there are many files that have the same hash value due to the pigeonhole principle and almost uniform distribution of the output of the cryptographic hash functions. This can be understand by the arbitrary input size of the hash function but fixed output size, like MD5 has 128-bit and SHA-1 has 160-bit output sizes but they can hash every file.

The probability will be reduced if you use two different hashes or even more, however, you don't need that. Just use a hash like SHA3-512 or Blake2-512 that has higher resistances then when both MD5 and SHA-1 combined. If you want the longer output to decrease the probability of successful attacks you can use XOF like Shake.

You can also use HMAC-SHA3 so that you will have a keyed hash that also provides unforgeability. This will help in the case that if attackers can access the file and hash of it at the same time then they can replace it with a new file with the hash of it. Since HMAC requires a key, they can not execute this attack.

Note that neither MD5 nor SHA-1 is considered secure anymore. MD5  and SHA-1 has collisions attacks.


Do SPA applications have different security considerations than HTML5 sites? I'm looking into Single Page Applications that are used for both mobile development (PhoneGap) and regular websites.

Since the application can load from a offline copy, can run from http://localhost , or can be packaged as an app visible in the Apple App Store or Android Play Store (etc), the standard approach of setting credentials for the user and accessing resources is different.

Namely, Microsoft has a whole infrastructure that enables OAuth for native applications (though I don't see if/how they address SPA applications).

Question

Are SPA applications more or less immune to CSRF, XSS, or other normal attacks?
What about SPA applications embedded in PhoneGap, or some other app?
Since SPA applications can read the REST data in the URLs passed to it, what protections are there from phone or normal web apps that respond this way?
Are there misconceptions about how to do SPA applications that lead to security vulnerabilities? (I've often seen app developers ask how to use Javascript "encryption" instead of HTTPS here)
Are authentication concerns different?  (HTML5 Session usage vs passing parameters to the second SPA page)

I haven't seen much discussed about this new way of developing an application in light of security, and suspect that there are many security missteps here.

Are SPA applications more or less immune to CSRF, XSS, or other normal attacks?

Generally, no.  The interaction between the client and the server should similar, if not identical to that of a plain-old-AJAXifed web app.  You're still dealing with HTTP requests and responses that are coming from an untrusted client, and must according be treated carefully, but there's no particular additional risk that I see as a rule.

However:

There are two of the OWASP Top 10 that are potentially more likely to be improperly guarded against.

1) Sensitive Data Exposure

If you're not carefully about what data is contained by the initial page load, you could easily be sending data that shouldn't necessarily be exposed to all users.  Because the entire page isn't generally visible in the browser in an SPA, this can lull a careless developer into a false sense of security.

2) Missing Function Level Access Control

In my mind, this is the big one when it comes to SPAs.  Since you're moving functions and logic off of the server and out onto the client, it's very, very easy to provide a client with access to functions that he is not authorized to use.  To some degree this can be mitigated by the fact that your data endpoints should also be separately protected and this should cause any attempts to use unauthorized functions to fail, but this is the one that gives me heartburn.

Are there misconceptions about how to do SPA applications that lead to security vulnerabilities?

Yes.  A major misconception (by less security conscious developers, in any case) is that the application logic still belongs to you, and that you can rely on JavaScript in the browser for things like input validation and function authorization.   As we all know, you can't.   If it's on the client, it doesn't belong to you.   Any validation and authorization that happens on the client is UX, not application security.   Your endpoints on the server are ultimately and totally responsible for ensuring the security of the data and the application.

Are authentication concerns different? (HTML5 Session usage vs passing parameters to the second SPA page)

Not that I can think of.   Remember, SPAs aren't a fundamentally different model, just a new way for allowing users to interact with a web application in a manner that takes advantage of modern browser capabilities to provider a better user experience.


What agency digitally signed Cryptowall 2.0 so that it can run without being detected? What agency issued a digital signature for the Cryptowall 2.0 ransomware virus?

Is it too early to tell?  As far as I know this is how Microsoft planned to prevent malware, by adding a digital certificate to the BIOS, or to any of the programs that get loaded on a Windows machine.

As far as I know, the malware is smart enough to delete all of the browser history on the day the system is attacked; which makes it impossible (from the desktop at least, maybe not from the router) to figure out what IP it came from.

But a digital certificate is only as good as the company that issues them; if there's human-corruption within that company then our data is all doomed.

Who signed Cryptowall 2.0?

You are technically wrong when you say "signed the virus". the CA NEVER signs any code. What CA can do, is issue a code-signing certificate. Then the MAKER of the virus do sign the code. This means the CA never see the code and you can't really blame the CA for issuing a code-signing certificate.

The Point of a code-signing certificate, is to bind the code to the person who signed it. So if the CA did a correct verification here, and the code-signing certificate was not leaked, then you should have the virus maker's personal details right in front of you, and it should be easy to get him prosecuted and liable for financial loss due to the virus.


Multiple devices encrypting data using the same key? I want to implement a service that can't read the data you store there.
The Idea is that I, like in a password manager, use the password to derive a vault key, which is different from the authentication key, that is used to encrypt/decrypt the data.
How can I encrypt and store data from multiple devices while only sharing the vault key in a way that allows new devices to join while all others are offline and while ensuring that no security issues arise from IV reuse in a setting where the client is unable to trust the server?
I cannot use the vault key directly because I can't know which IVs can be used when logging in from a new device, this creates the danger of IV reuse.
When creating the IVs randomly, NIST recommends a strict limit of 2^32 encryptions per key, this feels a little too low for me.
I can't trust the server with this either, so I must not rely on the server to generate/send the next fixed field to use as it might just send the same message to multiple devices.
One Idea I have would be to generate a key for each device on its own and store those keys, encrypted with the vault key, on the server (for other devices to be able to decrypt the data), and the IVs stay on the devices locally.
Each package then would then need know which key is needed to decrypt it, but this feels like a reasonable compromise to me.
I would have to think about what to do when the user changes the password, but I think I just encrypt the previous vault key with the new one and send it to the server ..
Is there a (better) way to share the vault-key-nonce between multiple devices in a way that no nonce is used twice without trusting the server with anything?

I feel like this question deserves the standard "Don't roll your own" (also here).

I want to implement a service that can't read the data you store there.

Unless I'm grossly misunderstanding your question, you're trying to implement what we call "end-to-end encryption". This is something that is both surprisingly tricky to get right, and has also been solved many times. That wikipedia page gives a bit of the history and pitfalls associated with E2E Encrytion. I would also suggest that you base your implementation on the Signal Protocol, here are some sources:

Blog description: https://medium.com/@justinomora/demystifying-the-signal-protocol-for-end-to-end-encryption-e2ee-ad6a567e6cb4
Formal protocol description in section 2: https://eprint.iacr.org/2016/1013.pdf
Project page including link to source code at the bottom: https://signal.org/docs/


Credit card information being sent over HTTP? My fiancee was browsing a website (www.medievalbridalfashions.com) and about to make a purchase when I noticed something. During checkout, everything appeared to be getting sent over plain HTTP.

I made a dummy account, went through the checkout process, fired up Wireshark and looked at the packet that was sent and the CC info was in plain text, along with expiration date, and security code.

Is this as big of a problem as I'm making it out to be? I am by no means a security expert, but sending unencrypted credit card information over the Internet makes me a bit uneasy.

EDIT: I appreciate everyone's answers. We're going to call her bank tomorrow to get a new card issued. We'll also try to contact the merchant and notify them. Thanks!

Yes, it's a big problem.  It's insecure, and it's a violation of PCI DSS 4.1:

4.1 Use strong cryptography and security
protocols (for example, SSL/TLS, IPSEC,
SSH, etc.) to safeguard sensitive
cardholder data during transmission over
open, public networks.

You can notify them that they're out of compliance, but the odds are they already know that.  If you can determine who their acquirer or processor is, you can try and notify them, as they're the ones who actually get fined if a breach occurs (...and they then pass fines down to the merchant(s) involved).  Overall, though, the PCI DSS structure is designed to encourage security and punish responsible parties, not to enforce security.


Freezing creates unusual pattern in kern.log My server freezed a few days ago. After restarting I immediately checked the logs and the only trace I saw were some dots in the kern.log. To my surprise, a day or two later these dots disappeared from the kern.log. Should I suspect that someone rooted the box and covered his tracks or rsyslogd somehow magically cleant this up?

The original:

Sep 28 10:30:23 arokr kernel: [49322.004919] audit: type=1305 audit(1411893023.336:1253): auid=4294967295 ses=4294967295 op="remove rule" key="audittools" list=4 res=1
........................................Sep 28 10:30:48 arokr kernel: imklog 5.8.11, log source = /proc/kmsg started.
Sep 28 10:30:48 arokr kernel: [    0.000000] Initializing cgroup subsys cpuset

Few days later:

Sep 28 10:30:23 arokr kernel: [49322.004919] audit: type=1305 audit(1411893023.336:1253): auid=4294967295 ses=4294967295 op="remove rule" key="audittools" list=4 res=1
Sep 28 10:30:48 arokr kernel: imklog 5.8.11, log source = /proc/kmsg started.
Sep 28 10:30:48 arokr kernel: [    0.000000] Initializing cgroup subsys cpuset

Provided that you accessed the log file on a console, did you have anything running in the background on the same console? If so, it's vaguely possible that whatever you had running in the background printed the dots, and it got intermingled with your view of the log file.

Otherwise, I would take it as a pretty bad sign. Log files generally don't retroactively amend themselves...


What is the need of "password" grant-type in OAuth 2.0? The need of OAuth arose because we wanted to give access of some of our resources at the Resource Server (for example my Name/Email at Facebook) to the 3rd party apps. This justifies various grant-types.

But for the "password" grant-type, the specification says this type is suitable in cases where the resource owner has a trust relationship with the client.

My question is what is the need of adding more complication if we can manage the trusted app with username/password?

The only relevant thing I can find at the spec is:

  It is also used to migrate existing clients
     using direct authentication schemes such as HTTP Basic or Digest
     authentication to OAuth by converting the stored credentials to an
     access token.

If this is the only reason, how would I get affected if I use direct authentication with "trusted-apps"?

First thing is that we should try to avoid password grant type as much as possible. But the reason why it is there is because it is better than storing the password.

Reasons:
Password grant doesn't need user to store his/her username password in the client. It is used only once only to get the access token.

Storing only the token is secure than storing the password in an external application (mobile aps, server side apps etc)
If user changes the password at the IDP, then app will again have to ask the user to enter his new password. This is not a good user experience. But in password grant-type, app can use the refresh token even when the user has changed the password.


Have there been any proposals for automation of EV certificate granting and renewal? With Let's Encrypt being the first CA to roll out ACME, setting up TLS on domains has become inexpensive, easy, and above all, automated.

Let's Encrypt has made it clear that EV is far from being an immediate goal of their organization, because of its requirement for human effort, which wouldn't be possible using their automated model -- but have any proposals come up over the years to either automate extended validation certificate signing, or to roll out alternatives to EV allowing for automation more easily?

EV and normal certificate have a very different goal in mind. On the one hand, certificates are for everyone. Everyone can and should get a certificate for their domain the only requirement is to own the domain.

EV on the other hand is a real proof of identity, not just the domain but that this domain is indeed the domain of this company that your are indeed a representative of this company, etc. It doesn't verify just the domain ownership but the real physical identity. That's a higher level of identity verification and thus a higher level of trust and it obviously can't be automated. And even if it could it shouldn't, the human verification is exactly what makes it more valuable.

The point of let's encrypt is that it is easy to get, so that every single website on the internet get https.

The point of EV is that it is hard to get. So that phishing gets harder. You probably can get a certificate for a domain trying to imitate a well known domain but you can't get an EV certificate for such a domain, because no human would allow that.

So making EV certificate free and automated by bots is completely missing the point of EV and it would lower the trust we get in all other EV protected domains. There is no point in having EV, if everyone can get one for free automatically. The extra price and verification is what make EV...  EV.


Impersonation of TLS host with own wlan network Problem: I have a local machine (IoT, lets call it MCC) which connects via SSL to a website (mcc.com) to get some JSON data. I would like to send modified JSON from my own server.

Idea: Setup a local device (lets call is rasp) which opens a wifi hotspot. The MCC should then connect to the rasp. The rasp answers with a certificate from the public server mcc.com, but sends the modified JSON data.

I am not familiar with DNS, but I expect this to be difficult as we do not own the public key of mcc.com. Does someone know some solution here? The MCC does not use some kind of DNS over https.

Idea: Setup a local device (lets call is rasp) which opens a wifi hotspot. The MCC should then connect to the rasp. The rasp answers with a certificate from the public server mcc.com, but sends the modified JSON data.

Your host rasp cannot impersonate mcc.com by providing the same public key. You would need the server's private key to do this. Therefore, if there's any checks on your IoT device towards verifying the TLS endpoint is valid (validates against a CA or uses certificate pinning), your idea will fail. Otherwise it might just work regardless of you using your own certificate on the fake server.

DNS is easy to tamper with since you control the local network and, as I understand it, traditional basic DNS is used. Ultimately you don't even need to touch DNS, you just need to intercept the TLS request and forward it to your own server.


Is it secure to use window.origin with postMessage? When using postMessage it's important to define a targetOrigin to ensure we don't leak data to other sites.
It's equally important to check the origin when receiving a message to prevent other sites from triggering our scripts.
But, if we're just expecting to do this on our own domain, is there anything wrong with:
targetWindow.postMessage({message}, window.origin);

--
window.addEventListener("message", e => {
  if (e.origin == window.origin){
    //Trigger something
  }
});

targetWindow.postMessage({message}, window.origin);

So line transmits the windows origin (e.a. The page domain loaded)
As the origin data for the post message. This is fine.

window.addEventListener("message", e => { if (e.origin == window.origin){ //Trigger something } });

This would check that the message received is from the same origin as this window. This is slightly more problematic, if someone hosted this code on same other domain it would still work. (If that’s not a concern than it’s fine). A more secure strategy would be to replace the window.origin   with a const ORIGIN = “<domain>; and if( e.origin === ORIGIN). This would make it impossible to redefine the origin mod processing of the javascript (or at least after the const) and would make the check do a type check and value check. (Instead of a typebended value check)
Source


best place to store backup encryption key I have a server on which I keep an encrypted backup of some data. The server updates the backup once a day if the data has been changed and is physically accessible to many people. Further, I would like to have easy access to these backups. Given these considerations, where would be the best place to store the encryption key?

There is the encryption key and also the decryption key. If you are using asymmetric encryption then the two keys can be distinct (though mathematically linked to each other), to the point that the encryption key can be made public.

In your situation, I assume that your server somehow obtains the clear data from an external source, and stores only an encrypted version of the data. If your server is hijacked (and malicious people with physical access can certainly hijack your server) the attacker just waits for the next batch of data and slurp it before it gets encrypted.

Solution is to change your model:

Have the source encrypt the data, not your storage server.
Use asymmetric encryption, so that the source needs only know the public key, not the private key.
Don't decrypt on the storage server either; decrypt on your laptop, onto which you download the encrypted backup files when needed. The private key is in your laptop.
Now that the storage server is not trusted for anything (it never sees the decryption key, nor the clear text data), replace the server with some cloud-based service, it is cheaper.

Storing secrets, any kind of secret, on a machine which potential attackers can physically access, is an absolute no-go. This will never be safe. There can be some mitigation, but that's very expensive, and not as complete as you would wish (it is more about post-mortem audit than proactive defence).


Hide a machine on LAN Is there any way to hide a computer on LAN? For example maybe with a firewall, when someone is going to ping a machine, it won't answer. In other words the machine must answer to router only.

I am the network administrator. The switch hasn't VLAN. I use Linux (Debian)

My topology is this one:

According to this answer you can deny all incoming connections using iptables -p INPUT DROP as following:

iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -p INPUT DROP

All incoming attempts to connect to your computer fails and only connections initiated by your computer works. So your machine won't respond to pings.

However you are still broadcasting ARP packets and connected to the router. You can't disable ARP requests because if you do you won't be able to use the network. So basically it is still visible according to this scenario.


What can I do as a user to minimize the risk of online banking? My bank uses a security system based on a card reader for online banking. The card is the same as used for ATMs and payment in shops. There are several known attacks on this system, for example as descibed here and here.

I do not have detailed information regarding the readers used by my bank. What I know is:

They can be operated with or without USB cable.
The readers are interchangeable, i.e., contain no personalized information associated with my account.

My question is, what I can do to minimize the risk of fraud. My thoughts so far are:

Use Tor for any interaction with the bank website.
Use a Linux installation in a VirtualBox (or other VM), used only for online banking. However, as far as I understand, this would not protect me from key-loggers on my host PC. It is also unclear to me how big the danger due to key-loggers is with a card reader, since the PIN is entered on the reader, not on the PC.
When used with USB connection, a driver on the host PC needs to be used (available only for Windows, so this is actually not an option, also due to the implied decrease of security). On the other hand, as far as I understand the USB connection could be used to get increased security, by displaying transaction-specific information on the card reader, which the user has to confirm. But as I understand from the papers linked above, this is often not properly implemented, so I don't know if the un-connected mode would actually be more secure?
The same cards are used for online banking and for ATM and payment terminals. Thus, it seems that losing the PIN and the information on the chip of the card (through skimming and/or being observed when entering the PIN) will automatically also give attackers access to online banking. Since both my wife and me have a card for the same account, does it make sense to (as far as possible)  use one of the cards as the "online banking card" and the other one as an "ATM card"? Would that substantially decrease the risk, or am I overlooking something?

Could you clear up my understanding of the points I described, as well as provide further insight?

I briefly read the papers you linked to and they expose several vulnerabilities allowing an attacker that can talk to the reader to make it sign transactions/login requests without requiring user consent. However, this isn't a big deal, for an attacker to "talk" to the reader your machine already has to be compromised and if that's the case, no amount of security can protect you.

On the other hand, this smartcard system is actually pretty nice and requires the card to be physically present to make a transaction, making stealing of card numbers useless. IMO, that's how online card payments should've been done from the beginning.

Now, let's go through your checklist :

using Tor is unnecessary; you don't need anonymity, and security is already provided by the fact that the bank's site uses HTTPS. Even in the case that their HTTPS implementation is flawed, Tor won't give you any more protection and at this point you shouldn't use their site at all.
using a VM on a compromised host is stupid. If your host is compromised, the attacker still has total control of the hardware and can even "talk" to the reader to exploit the vulnerabilities described in the papers you linked. Moreover, you won't be able to install the reader's drivers and browser plugin in a Linux environment.
given the papers linked in your question, I'd say offline mode may be more secure. It doesn't display transaction info, but on the other hand, it only allows them to make a single transaction, where as in the connected mode they can exploit a vulnerability to make the card sign an unlimited number of transactions without requiring user consent (as long as the card is in the reader).
card skimming won't allow them to make online transactions, as skimming won't steal the secrets in the chip, and this EMV-CAP system relies on the chip to perform crypto operations. The magnetic stripe is never involved. Stealing the PIN may give an attacker the possibility to make payments if they also physically steal your card. - skimming a smartcard chip is impossible.

TL;DR don't use a compromised machine and you will be safe. If you suspect your machine is compromised (because you installed pirated software or software coming from untrusted sources, keygens, shady "video players" or plugins, etc), reinstall it from scratch and be more careful. Finally, even if the machine is compromised, I doubt attackers updated their malware to exploit these readers - it's just not worth it (for now) as simply keylogging card numbers is still a juicy business and they have no reason to devote their time to update malware for the really low number of people who use these card readers.


Comprimising or affecting card readers, billing systems, or POS terminals using a malicious card Our company got a new card printer for employee IDs. It was a bit expensive and we had to undergo a background as it allowed us to print both mag strips and EMV chips. I don't understand enough about EMV chips but I found it would be very easy to duplicate my debit card's mag strip and make a fully working clone. As well as making it store whatever I wanted it to store. Which got me thinking about what are the risks of blindly accepting card data. Obviously a programmer should sanitize all input but what if there was an oversight. And someone finds an exploit in a processing/billing system to run their card and having it execute code embedded in the card. Much like how certain PHP scripts started getting compromised when they attempted processing an image's exif data or any other scenario of failure to sanitize input. I imagine it would be difficult with mag strips since there are limitations on what characters you could use and the length depending on the track. Like I mentioned I am unsure of the inner workings of EMV chips but maybe they would have more possibilities.

So I have a couple of questions I have been curious about. Is it possible to compromise or disrupt a system through a malicious card and has it been done before? Has this scenario already been explored and certain procedures are taken to prevent this by POS/Vending vendors?

What I know about the POS products I resell/support, when taking a credit card for a payment there are set # of characters it's looking for.

In a general sense it's looking for something like this:

16 digits for Visa/Mastercard/Discover
15 for Amex (will just use a Visa/MC/Discover for example)
4 digits for expiration
3 digits security code

So the system wants the data in this format

[Card number][Expiration][Security Code]

There is other information in the stripe, but just trying to illustrate a simple example.

Also, not mentioning chipped cards, just in reference to old magnetic strip only cards, for my example.

So let's say my POS system is expecting 23 digits (16+4+3) and I make a fake card with a card printer.  I have one right next to me on my desk.  However, I mess up in my order of information.

Instead of [Card number][Expiration][Security Code]

I do

[Security Code] [Card number] [Expiration]

The system would still take the information I've given, but most likely will come back with an "invalid card number" like message.

So redo my fake card with the right order of information.  Go to a store and try the card and it works fine.

Decide to include my payload at the end of the card.  My thought that one of two things would happen:

The card would go through normally, the system took it's 24 digits it was looking for submitted to the credit card company for authorization.
The POS would not accept the card as, the amount of digits on the magnetic stripes didn't match the standard set.

On #2 I have seen happen in the wild.  A chain of stores my company supports is next to a large university.  The University gives out ID cards, but they are also a credit card for the students to use.  They can use the card to buy stuff, and to get services (check out books and such) at the University.

Magnetic Stripe Cards have up to 3 tracks of information.  Two tracks are used for a credit card transaction.  One track can be used, but the merchant pays an extra fee as it wasn't a "track 1 & track 2" transaction.

After frequent calls from the store owners with the problem of "XXXX university cards don't work, unless we manually enter them", I went to the university and they let me see a card and swipe it to see how the information was being put on the magnetic stripe.  They were thrown back a little bit by my request, but they understood the problem and I did my test in front of them after an IT staff from the university watched me.

They were putting student ID information on Track 3 of the cards.  So the POS system I support was reading track 1, track 2, and track 3 and not accepting the card because it had too much information.

To fix the problem, the MSR (Magnetic-stripe-readers) at the stores we had to program to not read Track 3 information.

That was my experience with one POS product.  There are hundreds of POS products out there, and I would assume it would be standard practice to only accept "X" number of digits.

If this were a possibility, I would think the "weak" point would be the payment gateway that sends the card information to the bank for approval.

Point of Sale Computer---->Payment Gateway---->Bank of card-owner

The payment gateway sets the syntax of how they want to the data to come to them.

They might like a different way than my example of

[Card number][Expiration][Security Code]

So if we thought of exploiting it, I guess similar to a SQL injection attack, the payment gateway would be where to look.  PG's are pretty hardened systems so I'd imagine they wouldn't tolerate anything that's NOT in their syntax.


Why does Windows not always force me to confirm my password when changing it? If I can change my password with cmd net user example * without needing to confirm my old password, why, when I change my password in the usual way (via settings or control panel), do I need to confirm my old password? If the point of confirming a password is to prevent somebody who finds the PC open from signing in, this circumvents it!

In addition to what nobody said there's a more practical, but mostly internal, requirement here. Changing a local password in Windows without knowing the original password is called a reset. Resets cause DPAPI keys to be invalidated (because they're protected by a primary secret based on the user password). Once the reset happens those original keys are dead and cannot be decrypted because the new password doesn't match the old password.
Changing a user password requires knowledge of the original password so those DPAPI keys can be rotated safely.
Resets are, from an administrative point of view, a worst case solution for this reason. This is actually why you get the "irreversible loss" warning from lusrmgr.msc, and to do so requires local admin privileges.


Multiple VPN clients in parallel If I were to run more than one VPN clients on my machine, simultaneously, what risks would be involved?

E.g. are there technical conflicts, such that it wouldn't work right?

Could there be address resolution conflicts?

More scary, can traffic from one network cross over, via my machine, into the other network?
Or can my traffic accidentally be misrouted to the wrong network?

If it matters, the VPN clients I'm running are Juniper Network Connect, and Cisco's AnyConnect (On fully patched and hardened Windows7). I don't know much about the remote endpoints...

On a quite fundamental level, a VPN emulates a "private network" whose purpose is to be isolated from the Internet at large. The "V" means that such isolation is performed cryptographically rather than physically; however, the model is still "separate cables". If your machine is part of two VPN simultaneously, then the private networks are not isolated anymore. This tends to contradict the very reason why the private networks were set up in the first place.

A VPN implementation is called such because applications need not be aware of it. Applications use standard Internet-related protocols (DNS for name resolution, TCP and UDP sockets...) and the VPN picks up traffic and does its magic transparently. A typical VPN implementation hooks itself in the system routing tables, to receive packets which are meant for a given class of addresses. Two VPN can work in parallel only if the addresses used in the two private networks do not overlap -- and that's not easy to achieve, since private networks, being private, do not use a global address allocation scheme. Private networks usually strive on the "private classes" such as 10.*.*.* and 192.168.*.*.

The DNS is a good illustration of the problem of accessing two private networks simultaneously. When an application wants to access a machine named "example", it does not know on which network it is. That's the point of private networks: applications need not be aware of the existence of the private network. The private network hosts its own name server, which can resolve names for the machines it hosts. If you link to two VPN, then, for each name resolution, you will have to talk to both name servers. Hence, the name server from private network 1 will also receive name resolution requests for names which are in private network 2. This is fishy. And if the same name is used in both networks, then all Hell breaks loose. This is the same problem than overlapping IP addresses, translated to the space of names.

Also, if your machine acts as a router, it will happily route packets from one VPN to the other. On a Linux system, this is as simple as:

echo 1 > /proc/sys/net/ipv4/ip_foward

which some Linux distributions will do for you if you asked for it at installation time. Depending on the user not doing something like that looks risky.

To sum up, the normal model for a VPN is that:

a given user system is part of the VPN, only the VPN (and thus only one VPN);
if the system must be able to talk to the "outer world", it may do so only through a dedicated gateway which, from the user system point of view, is part of the VPN.

In particular, a system linked to a VPN shall not be linked simultaneously to another network, be it the VPN or the Internet at large. A proper VPN software will hijack the default route and make sure that it sees all ingoing and outgoing traffic for the whole system. By nature, this does not tolerate the simultaneous presence of another VPN.


How many possibilities can today's computers check (per second) in a SHA512 hash of a 50-byte-long random entry? The problem I want to avoid is "brute force" attacks against a database. So if I add a 50-byte-long cryptographically random salt to my information (which I don't need to retrieve, just its hash) - is it secure enough?

I know the answer is inexact - It depends on if it's a supercomputer, or a PC etc. I want to get a general idea - can a supercomputer go through 10^9 of them in a second? 10^20? Will it take a PC a year to go through all of them? Be vague.

EDIT:
The salt will remain in the hashed result only.

The purpose of a salt is not to make computing the hash slower, it's to prevent rainbow tables from being useful. A single iteration of SHA512 is way too fast to be useful against bruteforcing attacks.

On a decent GPU, you can do ~100M hashes/sec (new link) with SHA512. Multiply this for systems with multiple GPUs. With a slow KDF such as bcrypt, you can tweak the iteration count to be more suitable. You want something around ~0.3s/hash for a good security margin.

Keep in mind that 50 bytes is 400 bits, or a keyspace of 2^400. You're almost guaranteed to find a collision in SHA512 if you manage to compute 2^400 hashes. However, the attacker isn't trying to guess the salt. What you should be worried about is an attacker cracking the hashes when they already know the salt.

The solution is use PBKDF2, bcrypt, or scrypt, and store the salt in plaintext in the database.

Update:

It looks like you're trying to implement your own scheme. Please do not do this. There are two widely accepted rules of cryptography:

Cryptography is hard.
Don't roll your own.

I cannot stress strongly enough how dangerous it is to roll your own schemes, especially when dealing with crypto. Not even the legendary Bruce Schneier would dare write his own cryptosystem without serious peer review and months (if not years) of testing and tweaks.

The advice I've given you with regards to hashing is a standard based on peer review and a huge amount of theoretical and practical testing. Attempting to augment it using extra hashing and other black-magic is a bad idea, and will only increase the attack surface of your application and create a potential security flaw. Stick to the standard.


Token Based Authentication & Pass-the-hash Attacks Do token-based authentication solutions (such as RSA SecurID) mitigate tools like incognito and/or pass-the-hash tools?

If I understand the question correctly, then I'm guessing the simple answer is No. However, it depends on how, where and when the token is used to authenticate.

No, because once you authenticate (say using SecurID), and you are given some kind of a session identifier, it's the session identifier that matters for subsequent requests, not the initial authentication, which happens only once. Those tools grab those session identifiers, so work independently of any previous authentication. This is one of the fundamental problems with, e.g. Single-Sign-On solutions. They make user and administrators lives easier, but once you are authenticated, it opens up much more opportunity for attackers to abuse.

However, if you implement further authentication checks, don't rely solely on Windows authentication (use web-based authentication for example). Then you can mitigate those attacks to some extent. For example, some banks ask you to re-authenticate before making some transactions. Even if you're already logged in. You can in theory implement similar controls to reduce the effectiveness of those session grabbing attacks.


HTTP header error message looks wired. Is this a buffer overflow attack? My gerrit error log shows the following shell code like characters:

[HTTP-64] WARN  org.eclipse.jetty.http.HttpParser : Illegal character
0x5 in state=START for buffer
HeapByteBuffer@af151b6[p=1,l=3,c=8192,r=2]={\x05<<<\x01\x00>>>P\xC0c\xF660\x0000
OK\r\nDat...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
[HTTP-64] WARN  org.eclipse.jetty.http.HttpParser : badMessage: 400
Illegal character 0x5 for
HttpChannelOverHttp@75f6292d{r=0,c=false,a=IDLE,uri=}

I suspect this may be a buffer overflow attack, but I can not confirm that it is. Does anyone know what it is?

This use of null bytes is consitant with the Jetty Bleed attack.  This attack discloses server memory, which contain's the HTTP reqeusts from other users (similar to hearbleed).  This means that any passwords or secrets sent to this server maybe compromised.

Like any system, make sure you update.


What sort of delay will deter a robot from crawling my site? I use what I believe is the standard method of identifying bad bots that do not respect my robots.txt (i.e. disallowing crawling the bad-bots subdirectory, then logging those who still go there).

So far, I've just blocked bad bots based upon their IP-address after they've been identified.  However, I am thinking about introducing a more subtle approach for at least some (e.g. spurious offenders that may be false positives).  The idea is that the request will be served, but after a delay (e.g. implemented using PHP sleep()).  That way, a (patient) human being that just happens to be allocated an IP-address previously used by a bad bot will see the page, while a bad bot may just drop the request and move on to the next victim.

The question is: What number of seconds should I use in this type of scheme?  Ideally, it should be short enough to not be too annoying for humans, while long enough to deter a bad bot from crawling my site.

Alternatively: Is there some sort of method I could use to measure the time a bot trying to access my site wait for response before "giving up" and moving on?

Edit: The comments by Dinu Smădu and Rory Alsop has convinced me that introducing a delay is not a good idea.  And Polynominal has suggested that Security.SE may not be the most suitable venue.  So I've taken what I've learned here (thanks again, folks!) and posted a revised question at Webmasters.SE.

I don't think that this kind of approach is a good idea. By using the sleep() function on certain requests you are making it easier for an attacker to create Denial of Service. He would just create a lot of request to the resource you are serving with a delay. This way, the number of requests the server can process at a time would be reached and legitimate users would not be able to access the site.

Moreover, you do not have to "punish" the user by offering him a long waiting time. I would look for alternatives if a webpage is slow all the time.

The best protection is not have sensitive information that is publicly accessible. Use an authentication mechanism to protect those resources and allow access only to the users you want.

If you are trying to prevent bots from copying information from your site, maybe CAPTCHA could help. Use a CAPTCHA before displaying certain information.


What is the risk of someone intercepting my CSR and private key In the process of getting a SSL certificate, I generated a CSR and the private key and for some reason had to share them.

What could a malicious person do with those two files ?

If you do it properly, nothing.

The usual process for getting a TLS (formerly SSL) certificate from a CA is:

Generate server.privkey and server.csr (or equivalent) files on your machine. Keep the private key private.
Send the server.csr (certificate signing request) to the CA to get signed and become a certificate.
Take the certificate the CA gives you back and import it into your web server along with the server.privkey.

The CSR file is not sensitive and can not be maliciously modified without cracking the crypto (hard). You do not need to be overly careful about sharing this file.

The Private key, on the other hand, should be private. It should stay on your server. You should not share it with anyone. Again, this is private. All sorts of bad things can happen if bad guys get this. If you have already shared it with someone, I suggest you start the process over by generating a new keypair, a new CSR, and getting a new cert. This time, don't share the private key with anybody!

What's in a private key?

Your private key is the cryptographic identity of your server. When a browser connects to your site, your server sends down the certificate (containing your public key), and performs a proof that the it has the corresponding private key. Browsers accept this proof that it is talking to the real cutefluffyanimals.com, and not a spoofed version. The browser shows the green padlock and everything is good.

If a bad guy has a copy of your private key, then they also have the cryptographic identity of your server and can pretend to be you: intercept traffic going to your server, view information the user entered (including usernames/passwords), modify page content, pretend to be the server and respond directly to the browser, inject their own content or code or ads into your pages, etc. They can literally do anything because, cryptographically speaking, they are the real server. The browser will still show the green lock because the server it's talking to has the right private key.

Anybody who requires you to share your private key clearly doesn't understand how certificates work. Kick them in the face.


Automatically Open LUKS Container on System Boot in a safe manner I have a linux system running at a cloud provider where I created an encrypted container using LUKS to store personal data.

The encrypted container is manually mounted at /srv; the rest of the system is unencrypted so that the server and especially the ssh daemon start automatically on system boot.

At the moment, if the server restarts (because of an update that requires a restart or because the host system where the droplet runs required a restart) I need to manually open the LUKS container and start the services that store data in the encrypted partition (dovecot, mysql etc.). Of course, this is the logical consequence of having an encrypted partition. But I was wondering if I can automate this in a secure manner.

I do not want to store the passphrase on the server for obvious reasons. So I wrote a little script that runs on a Raspberry Pi at home: It ssh-es every 5 minutes into the server and checks if the Loopback Device is mounted. If not it mounts the container (relevant lines of the script, this is only executed if /srv is not mounted):

# Mount Srv Container
ssh root@<ip> "echo -n '*** my passphrase ***' | cryptsetup luksOpen /root/srv_container_file container -"
ssh root@<ip> "mount -t ext4 /dev/mapper/container /srv"

# Start Services that store data on /srv
# ...

The approach works but it feels super hacky. Not sure if the constant connections, aka active checking, are a good idea and I am also not sure if I am opening myself up to vulnerabilities by echoing my passphrase into cryptsetup.

Thus my question:

What is a good/standard way to automatically open the LUKS container without storing my passphrase on the server and without opening up my system to vulnerabilities (compared to manually opening the container)? References to official documentation are very welcome.

What am I trying to protect myself from?

I don't know how the cloud provider handles old and/or faulty disks. I don't want anyone to read my data from the physical disks or backups made by my cloud provider.
I don't know if my disk image gets moved on the physical storage (according to the docs of my provider it's stored redundantly), so I don't want anybody who has access to those blocks after me to be able to restore the data.
I know that once an attacker has shell access to my running system it is game over as the partition is open and not passphrase is needed.

Rather than having a local machine periodically query the server and push the key to it if necessary, you could do it the other way around and have the server pull the key from your local machine. The server and client can mutually authenticate each other with SSH, making it such that an active attacker who has access to either the local machine's storage or the remote machine's storage would be required to steal the key. If the attacker is passive and can only read the contents of the remote machine's disk, but not act on it (for example, by SSHing to the real server and backdooring it), pulling the password should be safe. The specific implementation is up to you, but it could be:

The server boots up, connects to your local machine, and requests the key.
The server and your local machine authenticate each other over SSH.
Optionally, the two machines can verify that the other is connecting from the correct IP.
After authentication, the server pulls the key from your local machine.

Since you specified that your threat model involves an attacker with complete access to the remote server's storage, be aware that you can only protect from a passive adversary, not one who is able to both read the storage and MITM your connection, or SSH in directly using stolen credentials.


Bypassing XSS filter <script>
Something.execute("injectionpoint");  }, true);
</script>

I am trying to bypass an XSS filter but its not working since since " is filtered as  \" or ;\" depending on where " is placed./ is filtered as \/.Any // present in payload is stripped out

Other characters such as ( ) , < , > , -- are not filtered

Here is an example with +alert(1)<!-- as payload

Something.execute("+alert(1)<!--");  }, true);

Bypass escaped double quote

Based on your description this should work:

\");alert("xss

The " will be escaped as \", thus resulting in \\", which escapes the \, but not the ".

To prevent this, you would at the very least have to also escape \ as \\.

Bypass escaped double quote and double backslash to single backslash

Based on your comment, I'm assuming the actual relevant parts of the filtering work like this:

"  -> \"
\\ -> \

This isn't secure either. An injection might look like this:

\\\");alert(1

" will be escaped as \" in step 1 which leads us to \\\\", which is then transformed to \\" in step 2. You can't use double quotes in the injected string, but that's not a problem as XSS with single quotes or completely without quotes is perfectly possibly.

To secure this the double backslash would need to be escaped, not transformed to a single one, which would give us \\\\\\\\\" with the above described injection, which is safe.


DMARC "policy_evaluated" is "fail" for SPF, even when SPF domain alignment is "relaxed"? A DMARC aggregate report which I received reads (irrelevant pieces removed, domains changed):

 <record>
    <row>
      <policy_evaluated>
        <disposition>none</disposition>
        <dkim>pass</dkim>
        <spf>fail</spf>
      </policy_evaluated>
    </row>
    <auth_results>
      <dkim>
        <domain>mail-provider.com</domain>
        <result>pass</result>
      </dkim>
      <spf>
        <domain>subdomain.mail-provider.com</domain>
        <result>pass</result>
      </spf>
    </auth_results>
  </record>

I do not understand why evaluated DMARC policy is fail with respect to SPF. As <auth_results> show, SPF by itself validates. AFAIK, in this case the DMARC failure can be only caused by passed SPF identity not being identity-aligned according to DMARC policy. But how could it happen in my case?

The DMARC RFC 7489 reads:

  Identifier Alignment:  When the domain in the RFC5322.From address
        matches a domain validated by SPF or DKIM (or both), it has
        Identifier Alignment.

Domain in the "From:" field is mycompany.com.
SPF record for mycompany.com is include:mail-provider.com.
SPF record for mail-provider.com contains a range of IP addresses they use to send mail from. The mail has arrived from an address in that range.
DMARC policy for mycompany.com does not require "strict" alignment for SPF.

I thought that the "passed SPF identity" in this case is mail-provider.com, for DMARC to pass it needs to align with subdomain.mail-provider.com, and it does so in "relaxed" mode. What am I missing?

Relaxed in DMARC doesn't mean completely liberated, but has limitations.

From RFC 7489, 3.1.2 SPF-Authenticated Identifiers (emphasis is mine):

  In relaxed mode, the [SPF]-authenticated domain and RFC5322.From
  domain must have the same Organizational Domain.  In strict mode,
  only an exact DNS domain match is considered to produce Identifier
  Alignment.

The algorithm to determine the Organizational Domain is specified in section 3.2, but basically the Organizational Domain is just your domain (including TLD) e.g. example.com is the Organizational domain for all a.b.c.d.example.com.

  Thus, since com is an IANA-registered TLD, a subject domain of
  a.b.c.d.example.com would have an Organizational Domain of
  example.com. The process of determining a suffix is currently a heuristic one.  No
     list is guaranteed to be accurate or current.

This means that the relaxed alignment for From: user@example.com would pass if the envelope sender used in SMTP MAIL FROM command was something like newsletter@mail-provider.example.com as the organizational domain for both is the same, but example.mail-provider.com has a different organizational domain and fails.

So, what's the solution?

You don't necessarily have to do anything. DMARC passes if either SPF or DKIM passes.
If you want both to pass, the mail provider has to use your domain or its subdomain as the envelope sender. That should be possible, as you already have include:d their SPF in your SPF record.


What is the difference between data owner, data custodian and system owner? I just started studying up for the CISSP and am having trouble understanding few concepts:

Data owner
Data custodian
System owner

Somewhere I read:

The data owner (information owner) is usually a member of management who is in charge of a specific business unit, and who is ultimately responsible for the protection and use of a specific subset of information.
The data custodian (information custodian) is responsible for maintaining and protecting the data

But in the practical world, what exactly is the boundary for these roles? Both seems to be protecting data.
Any real-world example helps.

Real example:

Data Owner - the administrator/CEO/board/president of a company

Data custodian - the ones taking care of the actual data - like IT staff (generally) or HR staff (for HR-related data)

System owner is the individual that is in charge of one or more systems, which may contain and operate data owned by various data owners.

Example, from a pure CISSP perspective: the IT servers staff. They are responsible for creating information plans together with data owners, the system administrator and end users. They must maintain the system security plan by the pre-agreed security requirements and he in involved in many security aspects of all systems that hold the data.

Limited Example: a HR employee that has a PC with company data on it is in theory a system owner, but not a data owner. He will operate on the data but the data does not belong to him. So the system owner may be considered an operator in such a limited case. Although in most cases such employees should be just users, in many cases they are not only that, therefore they can be put under this category.


Why are user names generally not stored in session cookies and provided with session IDs? I have been reading a little bit about security lately and wondered this. Why are session IDs not essentially temporary passwords linked to the user name? Both being sent from the client and checked by the server with each request.

From what I can make out it would be more difficult to hijack by brute force (though perhaps not more than just adding more bits to the session ID), help prevent session fixation and improve logging to discover how/why the site is being attacked.

Though from what I can make out it's not standard practice, so I feel like I must be missing something.

A session id is a temporary password which is usually linked to a username. Anonymous sessions are also useful tools in some cases.

Storing the username on the client serves no useful purpose. If the server trusted this information then it anyone could gain control by changing their username cookie to 'admin' or root'. Hence the session id does identify the user as well as proving the state of authentication, but only via an indirect lookup stored on the server.

In addition to anonymous sessions, it's also worth noting that the session data may be more than just a username and authentication state - it may also contain authorization information (e.g. roles) user preferences and (within bounds) transactional information. Storing information securely is not easily done on a substrate which is not protected against tampering.

I don't understand how you think this makes session hijacking / fixation more difficult; you've not explained why and you have some misconceptions about the way sessions work.

Certainly if the cookie data was trustworthy, then it would be easy to associate the true identify of an attacker with the http requests however the data is NOT to be trusted.

There are other ways to map identities to requests at the webserver - most SSO implementations provide for populating the webservers notion of the authenticated user. The information can be pushed up from the application (e.g. mod_auth_memcookie) or indirectly via other vectors such as supercookies and browser fingerprinting.


How to satisfy requirement 10.6 of PCI DSS? The company I'm working for is applying for PCI compliance and I'm in charge of writing most of the required procedures and policies. The problem is that I don't have any experience with IT security, so most of what's written on the PCI DSS doesn't make much sense to me. To keep the scope of this question small enough, let's focus on the requirement 10.6:

  Review logs for all system components at least daily. Log reviews must include those servers that perform security functions like intrusion-detection system (IDS) and authentication, authorization, and accounting protocol (AAA) servers (for example, RADIUS).

And the corresponding testing procedures:

  10.6.a Obtain and examine security policies and procedures to verify that they include procedures to review security logs at least daily and that follow-up to exceptions is required.
  ￼￼￼￼￼￼￼￼

  10.6.b Through observation and interviews, verify that regular log reviews are performed for all system components.

What does it mean, exactly, to review logs?
What constitutes an exception?
What do companies usually do in case of exceptions?

Reviewing logs essentially means to read through them and look for anything that might constitute an attack or security risk. In general you're looking for anything unusual. You might use various log filtering tools to aid you in this activity, or prioritise your events by severity if you're looking at IDS logs.

An exception, in this context, is any log that falls outside the normal pattern of activity. What they're saying is that you can't just review logs and then do nothing about your findings - you must follow up on any unusual traffic, and do some investigation into the source and cause. If your investigation into an exception turns up something meaningful, you also need to act on it. Normally this involves documenting the event and proposing a mitigation.

Essentially the point of this is to ensure that you are actively monitoring any potential intrusion attempts.

As an example, let's say you've got an IDS that sits on the perimiter of your DMZ. In order to comply with PCI-DSS 10.6.a, you must read through any logs and alerts at least daily, and investigate the source of them. You might find that a device performed a port scan, which you would have to document, and do some research into where it came from. If you identify that the device is not on your assets list, you might decide to add a firewall rule to block it. Keep in mind, though, that this is just one example - PCI DSS leaves this intentionally vague in order to cover all kinds of events and logs.


Why do most ip camera manufacturers set an easy default password? A good chunk of ip cameras come with an easy default password which is the same for all models. It usually is something like admin, 1234, root ...

The basic customer doesn't know that millions of ip are being scanned every seconds and that their ip camera will be discovered in minutes if not in seconds. Thus, the basic customer often does not change the default password.

Why are most ip camera manufacturers, which obviously know those fact since it's their business, not setting a different randomly generated password for each camera ?

Cost.

Configuring a random password per device, and including this in the documentation (e.g. a sticker or similar) costs money. People don't check such things as security before they buy; the main bullet points for ip cameras tends to be video quality and things like cell phone apps.

Thus security doesn't really give an advantage to a manufacturer, and they ignore it. In essence they externalize it - the customer has to pay the price of poor security.


Can you detect a wifi pineapple or rogue AP with MAC address? This posting has some good advice for tracking rogue access points:

Tracking down a rogue access point

The issue I have is that many will not work for a huge deployment. I'd like to build a device to look for them that I can keep on me and walk the property, when it detects something it will fire an alert. I can handle the scripting for this, but I am uncertain if my hunch is correct: Does the pineapple spoof AP MAC (BSSID) as well as SSID? If not a default setting, I think I can create a list of all our MAC addresses and compare them to what I see in the facility per our SSIDs.

Edit/Update:

I found some information on another posting and I want to be clear I'm referring to an Evil Twin, which is a subset of Rogue AP. Yes, a rogue AP is a big deal, but an Evil Twin/Pineapple which is ssl stripping and trying to steal CC's and etc. is a problem. @OscarAkaElvis said this:

"Not exactly. In an Evil Twin, you can "clone" a network but not entirely. I mean, it is supposed you clone "almost all" network characteristics.For example usually is cloned SSID, same channel but the BSSID usually is cloned except one digit. The reason is because an Evil Twin usually is launched at the same time with a DoS to the legitimate network to force users to disconnect. And your fake network can't be exactly the same or the clients of fake network will be kicked too. So the user usually should click voluntarily in the fake network as a consequence of desperation of not having internet"

Which makes sense as if there are 2 BSSID exactly the same you'll tons of issues. This is what I had suspected, but I wouldn't call it confirmed. Can anyone confirm this?

link to other question I took this from: Whats the difference between an evil twin and a rogue access point?

Rogue access point is a very serious problem. I think it is easy to attack, but hard to defend.

  Does the pineapple spoof AP MAC (BSSID) as well as SSID?

Unfortunately, a pineapple or rogue AP can spoof MAC addresses. Therefore, comparing MAC addresses can not provide a proper detection. The term you need to look for is Wireless intrusion prevention/detection system.

What is a wireless intrusion prevention system?

As it is written in Wikipedia,

  Wireless intrusion prevention system. In computing, a wireless intrusion prevention system (WIPS) is a network device that monitors the radio spectrum for the presence of unauthorized access points (intrusion detection), and can automatically take countermeasures (intrusion prevention).

As  a result, you need to implement a wireless intrusion prevention/detection system. There are many tools that can do it for you, however I am not going to do any tool recommendation here. Plus, there  are open  source  tools,  such  as Snort-Wireless  or  Kismet,  which  have  mainly intrusion detection capabilities. I do not want to write about WISP more, since this post is about "rogue AP detection". If you would like to know about them in detail, you can check on the internet. I also found some good articles about it;

SANS - wireless-intrusion-detection-system
Revista Informatica Economică - Wireless Intrusion Prevention Systems
Symantec - Wireless Intrusion Detection Systems