Why is it impossible to verify whether a file has been modified since creation? From what I understand, it is impossible to verify whether a file has been modified since its creation. Specifically, I was wondering whether it was possible to verify whether a photo was modified since its capture. However, according to the question "How to detect if a photo's metadata has been changed?" it is not:

  It is sadly impossible to to prove when an image (or any file for that
  matter) originated. It is possible (if the author wants to) to prove
  that a file existed prior to a given time by signing the file from a
  third party time stamping server (through which the third party proves
  that the file existed at the time of the signing) but such information
  is not automatically possible and can easily be stripped.

  I am also an IT Security guy and there is no possible secure way to
  prove the creation date of any file if the user controls the system
  creating the file with current technology that I am aware of. The best
  bet would be a device with a locked clock that would have a hidden key
  store that the user shouldn't have access to and create a signature
  based on this so that they couldn't fake their own signature, but
  since the key must still reside in the device, it is still feasibly
  possible for someone to break as all the necessary information is in
  their possession, even if it is hard to get to.

I feel like this explanation is somewhat similar to why DRM does not work (you can't give a person the lock and the key), but I'm still not clear on the explanation. I also think this is different than how TLS/SSL works. In the aforementioned case, you're trusting a source to give you files without any information on how many times the files were altered.

I think you will want more of a philosophical answer than a technical one, given what you are rejecting.

A file is just a discrete collection of bits. Relevance and meaning are overlaid onto those bits by a human, but ultimately, it's just bits. How would it be possible to determine if the bits you have are in the same sequence in some unknown previous state? Answer: saving that state in a way that can be trusted to be used as a means of comparison.

That's why TLS/SSL uses 3rd party CAs to verify certificates, and why digitally signing files is useful. They provide a trusted means of having a state to compare. It's not perfect, but very effective if performed correctly.


NX bit causes segfault on NOP slide? doing an assignment for university.

We have to exec a shell on a remote server. We're told the NX bit is not set, however, when we redirect to our injected code, the server has a segmentation fault. Am I right in thinking that the bit is, in fact, set in this case? The injected code is a load of NOPs followed by some shell code in a buffer. We overwrite the EIP to redirect to near the start of the buffer (in the NOP slide) but instantly we get a seg fault.

Thanks for any help!

If you are stepping through one instruction at a time, and the segfault occurs immediately upon jumping (and not when hitting some potentially broken shellcode at the end of the NOP sled, which could also cause a segfault), and you are certain that the address is correct, points to valid memory and that your NOP sled itself isn't broken, then yes it seems plausible that the segfault is being caused by DEP.

However, the other things I list above are more likely in my opinion, and there are lots of other reasons why a segfault might pop up.

Just so we're certain you've got everything right in gdb;

You should have a breakpoint just before the return instruction you have corrupted. You can do this via the disas and break commands.

Once the program hits your breakpoint, you want to check the lay of the land. Check eip with the info r command. And have a look at your stack using things like x/40x $esp. You should be able to see your nop sled, shellcode, and return address repeatedly afterwards. Another note that just came to mind; the return address has to be aligned properly, usually this means putting 1-3 nops after your shellcode to shove it into place.

If all looks well, then it's time to run a step. If info r now reports that eip contains an address that is on your nop sled - check this with a x %eip, you should see 0x90909090. Then hit step again. If at this point you get a segfault, then yes (to answer your original question :P) you have DEP turned on IMHO.

Sorry if that was all stuff you already knew, it's just vital to check everything several times when you're playing with memory exploits.


How does using port mapping create a leak from the VPN? I have red in the discussion forums of VPN services, such as Private Internet Access, that torrent clients should have certain features disabled to ensure security. For example disable "UPnP Port Mapping" and "Nat PMP Port Mapping". To my knowledge these are techniques to get around NAT which interferes with uploading files. Why would these be threats to the VPNs security/anonymity?

From here

  UPnP and NAT-PMP are security risks and should be left disabled. They
  won't affect port forwarding on the VPN.

and here

  You should disable UPnP and NAT-PMP, it's not used with the VPN but
  could leak your IP.

TL;DR how is UPnP or NAT PMP port mapping a threat to the VPN connection?

These protocols are used for inbound port mapping, not outbound port mapping.  Inbound port mapping makes it possible for your machine to listen to unsolicited connections from the Internet.  When the Torrent client opens these ports and listens, it may not be aware of the VPN connection and will instead advertise your real IP address.

Even if the VPN IP were to be used, with PIA or similar you're likely behind another layer of NAT which is not in your control, and almost certainly has no awareness of these protocols.  I.e., it would be non-trivial to manage a listening port on a shared VPN service with hundreds of users per IP.

"The protocol automatically determines the external IPv4 address of a NAT gateway, and provides means for an application to communicate the parameters for communication to peers. " https://en.wikipedia.org/wiki/NAT_Port_Mapping_Protocol


Brute Force Post via Hydra I am trying to brute force an HTTP login form via Hydra.

The problem I am having is in regards to the response code returned by the page. I am receiving false positives on every password.

Even failed logins return HTTP 200 responses, which I believe is leading to false positives.

How can I alter hydra to look for something like content-length header or a unique string returned to avoid the false positives?

Getting a 200 response is fine. You need to tell Hydra what to look for in the response page.

For example, if I log into SocialSite.com/login.php and my creds are wrong, the login page will return with a message of Bad username or password!

You can do this by adding some of this text to the end of your hydra command

hydra 192.168.1.69 http-form-post "socialsite.com/login.php:user=^USER^&pass=^PASS^:Bad username" ...

notice at the end of the http-form-post arg there's :Bad username" That tells hydra to look for that text in the response.

Here's a full example for you to reference


Can an android malware persist even after uninstalling it? I recently installed a modded apk and even after uninstalling it it displays toast message (link  below) each and every time I connect to the internet. I checked installed apps and system apps but there is nothing there. Installed Kaspersky and scanned nothing found. What can I do to know if the device is infected and remove it ?

First there was CarrierIQ (2011) on the HTC EVO 3D (and I think a few other less-known devices), which was a vendor faux pas. It couldn't really be uninstalled -- there had to be a ROM update.

Then came the first system-level Android malware, Droid Kungfu (2011). Kungfu would replace dhcpd and even the boot animation. It wasn't exactly an app that you could uninstall.

Obad (2013) was probably the first Android bootkit. However, it was relatively-easy to remove compared to what would come.

One of the nastiest Android bootkits was Mouabad (2014) aka Oldboot -- https://blog.lookout.com/mouabad

Oldboot was heavily-researched:

http://contagiominidump.blogspot.com/2014/01/android-oldboot-mouabads.html
http://blog.rootshell.be/2014/06/26/hack-in-paris-2014-wrap-up-day-1/

Later, in December 2014, Palo Alto Networks Unit42 released some research on an Android bootkit they found named Cool Reaper -- https://www.paloaltonetworks.com/content/dam/pan/en_US/assets/pdf/reports/Unit_42/unit42-cool-reaper.pdf -- http://contagiominidump.blogspot.com/2014/12/coolpad-android-devices-coolreaper.html

In 2015, the Cloudsota malware was found to be shipped on Android tablets sold on Amazon -- http://www.cmcm.com/blog/en/security/2015-11-09/842.html

Even recently in 2016 a Yashi smartphone was found to contain a bootkit --
 http://www.tgsoft.it/english/news_archivio_eng.asp?id=693

The Adups Android bootkit was also detailed in late 2016 -- http://www.kryptowire.com/adups_security_analysis.html -- and it was sending private data to China -- https://www.schneier.com/blog/archives/2016/11/smartphone_secr.html

The company, Kryptowire, that found Adups also found some Blu Phone that contained bootkit-level malware in 2017, for phones again being sold on Amazon no-less -- https://threatpost.com/amazon-halts-sale-of-android-blu-phone-amid-spyware-concerns/127141/

This topic has also been discussed on the Android StackExchange forum here -- https://android.stackexchange.com/questions/164898/can-rooting-remove-all-malware-viruses-and-backdoors -- with some suggestions and links to more information on removing system-level rootkits, if not bootkits.


Golang REST API: Security checks? It's my first time building and deploying a REST API with just the standard library. Are there any gotchas I should keep an eye out for regarding securing my REST API?

Here's the list of best practices in securing RESTful API.

Always Use HTTPS - Traffic must be encrypted
Never expose information on URLs - as this can be captured in web server logs, which makes them easily exploitable.

https://api.domain.com/user-management/users/{id}/someAction?apiKey=abcd123456789
Consider Oauth
Adding Timestamp in Request - This will prevent very basic replay attacks from people who are trying to brute force your system
Input Parameter Validation - Put strong validation checks and reject the request immediately if validation fails.
Use Auditing and Logging - Any subject or entity can be audited

For more information, OWASP Provide a cheatsheet found here.


3rd Party Authentication protocol I have a hardware device (H), phone (P) and web server (S). I would like P to be able to send commands to H, but only if it is authorized to do so. Permissions are stored on server. Technically I could do this with Kerberos, but that seems overkill. The protocol I currently have is the following:

P requests nonce from H (prevent replay attack)
H sends nonce to P
P forwards nonce, along with the command it wants to send to H, to S
If P has permission to execute the command on H, S sends Encrypt(Nonce|Command) to phone. This is encrypted with a key that H and S share in advance. (P authenticates itself to S with username/password)
P forwards Encrypt(Nonce|Command) to H.
H decrypts and verifies nonce. If correct, it executes command.

Is this safe? I know you shouldn't create protocols yourself so I'm curious if this already exists and if it is used in other places?

Based on your comments it sounds like S is passing some encrypted or signed access token to P that it passes to H. H can decrypt or verify the token is authentic and use the information contained within to determine of P is allowed to perform the app. That sounds great.

I'm not sure that you need a nonce here if all you are trying to do is prevent replay. You could just use a serial number. Only accept requests that have a higher serial number than the largest one you've seen. This will remove a full round-trip communication and greatly reduce your bookkeeping. If H can lose the current serial number (eg: by rebooting) then maybe you should keep the nonce.

In general, what you're doing sounds pretty reasonable. That said, it would be better if you didn't design and write your own security. Use SAML. It has been extensively studied and is much less likely to have a design or implementation flaw than any solution you can come up with.


Unlimited Private Email Aliases? I don't know whether this question belongs here but I can't think of any other community that would want or know a service like this the most.

I'm looking for an email provider service that allows me to create and destroy children email addresses easily, and to manage and view them all from a single place. It'd behave like a single inbox, aggregating the emails of all addresses.

This would allow me to, for example, sign up to your-service.com with g063d0442-8eee-427c-8c71-70c27cdd895a@provider.com and your-newsletter.com with g40def3e6-6cdf-4191-b163-9fa3ce4997c3@provider.com. If I find out your-service.com sends unwanted spam or leaked the database, I can just cancel the associated address in a second and no one would be the wiser.

The UX would be somewhat similar to Bitcoin's HD Wallets.

It's also relatively similar to disposable email addresses as offered by services like Mailinator, but private.

I'm aware of base+alias@provider.com type aliases, but AFAIK they always expose base and @provider.com, which is something I'm looking to avoid.

There also seem to exist services such as https://www.33mail.com/ which provide unlimited aliases by offering a subdomain of the provider, so everything@you.33mail.com will be aggregated in your inbox, but again, it has the same problem of exposing the parent address.

Church of the Swimming Elephant

Seriously!

It's a security site that provides various privacy services to include exactly what you appear to be asking.


Can sessions be handled securely with cookies disabled? I've been doing some reading here about session ID handling, and have learned that it's generally a bad idea to include a session ID in the HTML source code, and/or on the query string. For example Is it correct to use form field(hidden) for storing Session Token and Why is passing the session id as url parameter insecure?

With that in mind, is there a secure way to handle sessions if cookies are disabled?

As an example, I noticed my company's shopping cart puts session ID's in a hidden form field (for the add to cart action), and if cookies are disabled they're also appended to query strings for all links. I checked a cached google page and sure enough google had cached its own session ID. I then grabbed that session ID and visited google's shopping cart - it was expired by this time. Still, I'm obviously not a fan of this being possible in the first place.

On a related note, when I pasted the first link above, it originally included ?newreg=XXXXXXX (looked like a session ID of some sort). I had just registered for security.stackexchange.com and was brought back to that URL. Maybe it's not a problem but I thought it was a nice coincidental example of how session ID's can accidentally be shared.

I'd say that it depends on your use case.  If you look at an HTTP POST request there are essentially three areas where data can be placed, the headers, the URL and the request body.

If we're ruling out putting the token in the request body or in the URL, that leaves us with the request headers as a place to put the authentication token.

There are existing schemes that make use of this, for example HTTP Basic Auth, Digest Auth and NTLM Auth .

However each of those has got downsides and whether they're appropriate/secure for your application would depend on the application, the threat model and the user population.

If, for example, you're talking about an internal corporate Application where all the client machines are running variants of Windows, then NTLM auth would likely be a good idea.

If however you're looking at a general e-commerce set-up with a variety of end user Operating systems, it wouldn't be.


My email address is being used to enroll for online services. Should I be concerned? Just before Christmas I received the following message in one of my GMail accounts:

  Sign-in attempt was blocked
  ********@gmail.com [redacted by me]

  Someone just used your password to try to sign into your account.  Google blocked them, but you should check what happened.

I signed into that account and looked at the activity (not by clicking the link in the message, of course) and indeed there was a sign in attempt blocked from the Philippines.

I gather this means that an attacker entered the correct user name and password for my account, but was likely blocked because they couldn't pass the MFA challenge.  Or maybe Google's fraud detection is actually decent and it knows I've never been to the Philippines?  Either way, I immediately changed the password and (as far as I know) the attacker didn't gain control of the account.

However, in the 2 weeks since then, I have received several email verification requests from various online services that I never signed up for -- Spotify, OKCupid, a Nissan dealership in Pennsylvania (that one's interesting), and a few others I've never heard of before.  Someone out there is actively using my GMail address to enroll for these services.

The account in question is not my main account, and while the password on it was admittedly weak, it was also unique (I never used it on anything else).  I changed it to a password that's much stronger now.

Should I be concerned about this?

Also, if the attacker didn't gain control of the account, why use it to enroll in all these services?

Should I be concerned about this?

Yes.

This should be of concern to you because an attacker was able to obtain the valid password for your Gmail account. From the details of warning you have provided, it looks like it is from fraud detection rather than an OTP failure. If it was an OTP failure, you would have received an OTP when that login attempt was made (unless your OTP delivery mechanism is not email or SMS based).

You should explore the possibility that your password may have leaked. Do a search on HaveIBeenPwned to see if any of the websites where you have used that email were compromised.  It is likely that you may have used the same password for signing up to a trivial service and forgot all about it.

The the intention of attacker was not to use your email to enroll these services, rather it looks like an attempt to verify if you are a user of any of those services.  Most sign up options would ask you to login instead of sign up if you have an existing account with them. From the looks of it, the attacker wanted to identify the services you are already enrolled to with that email and wanted to try the same password on them.

To sum it up again, yes you should be concerned. You should explore why you are being targeted in the first place and how that initial password compromise may have happened.


Using the filehash as the key I want to ensure that everyone who encrypts a given file gets the same encrypted file without knowing the password.

So, my idea was the following:

hash the file
encrypt the file (e.g. AES) with the hash
publish it

Can this be done, if yes, is it secure?

The use case would be deduplication. Anonymity is not an issue.

Yes, it can be done. It has been used by some companies to allow deduplication of encrypted files. As in order to view the contents you need to know the hash, it is fine in principle (assuming you choose proper ciphers, hash, etc.)

However note that it allows metadata correlation. As the NSA, if these people all share the same file, even if I don't know what it is, I know they have the same contents. Similarly, if an entity suspects it may be infringing their copyright, using a consistent hashing means they could determine that a given file is what is being shared.


Why is it necessary to minimize redundancy in the ciphertext of a stream cipher? I am utterly confused about this.  I understand why you would want to minimize redundancy if you're using a substitution cipher, but why is this necessary when using a stream cipher such as RC4?  Since the attacker does not have the key, how would they draw any conclusions about the contents of the plaintext based on the relative frequencies of bytes in the ciphertext?  For example, RC4 was found to have a weakness in that zero bytes are more frequent.  But a zero byte can correspond to potentially any byte in the plaintext, since you're XORing each byte of the plaintext with a different value.  So how would this be exploited?  I hope this question makes sense.

The main problem with the bug you are describing is that 0 appears more frequently in certain bits of the output stream. The most common attack is that an attacker can make a victim create millions of connections to a server, while observing the network traffic.

To give an example, let's change 'bit' to 'byte', increase the chances and see what happens.

Let's say:

I have a secret cookie with the value 'a';
I have some kick-ass stream cipher that output random bytes;
an attacker can make me perform millions of connections to a server;
on every request, the first character for my plaintext is my cookie ('a') followed by some other plaintext;
encryption is an xor of plaintext with the bytes generated from the stream (like with RC4);
that attacker can monitor my network traffic.

With every new connection I make to the server, a new random stream is generated. This means my cookie ('a') will be xor'ed with a random byte every time. Because this happens uniformly random, our attacker can't deduce information about the cookie, as the chance of 'a' xor any character is 1/256.

Let's now introduce a flaw to our stream cipher. For the first byte, it has a tendency to output 'b' with a 10% chance, and it has a 90% chance to output any other character. Now, if the attacker has me create 10 connections to the server, there is a 1/10 chance that 'b' xor 'a' appears as the first byte of ciphertext, instead of the previous 1/256. So after 100 connections, 'b' xor 'a' should have appeared about 10 times, etc etc.

Keep in mind that there are also other types of attacks on RC4. The summary of attacks on Wikipedia is actually very nice:

https://en.wikipedia.org/wiki/RC4#Security


Storing OAuth and other authentication tokens We all know that when to store passwords, we should store it with one-way hash such as a variant of SHA, bcrypt or scrypt to prevent plain-text password leaks when the database is hacked.

But what about OAuth tokens? How should one store Facebook access token? Twitter access token? Should I store it as plain text? Encrypt it with AES and a site key? Or any more secure way to store it?

(Provided that the application requested only essential token scope from Facebook and the app have good reasons to store the token)

If at all possible, don't store OAuth tokens! Storing OAuth tokens makes your users susceptible to an attack vector they aren't aware of.

If you must store OAuth tokens then AES encrypt them with the best key you can use for this purpose. If users use a password to enter your site then generate an AES key based on the clear text password of each user (e.g. using PBKDF2) and encrypt the OAuth token of each user with their AES key.

Use a site key only as the last resort if no other options exist and do your best to secure the site key as per @tylerl's answer to Where to store a key for encryption?. But as @tylerl wrote, "there isn't a good answer".

So, again, if at all possible, don't store OAuth tokens!


Use WiFi tracking to identify burglars Recently I had the following idea.

I live in a rural area where few people pass in front of our house. Burglars like such areas, because the chance of being seen breaking into a house is small.

Assuming burglars carry a smartphone, would it be possible to somehow track them? I imagine a system where requests for WLAN networks (which I think happen regularly with WiFi enabled on smartphones) store the request and some data about the phone in a database, together with a timestamp. If someone then breaks into our house, we just pass the logged information on to the police.

Would the data transmitted by smartphones suffice to help the police? If yes, which parameters specifically would I need to track, and what technical infrastructure would be needed?

This can be done (see other answers) but the better question is-- even if you spent $1000 on all-new networking equipment, routers, wifi pineapples and whatnot, and you successfully captured the burglar's phone's hardware MAC address, the better questions are:

How does this prove that the actual owner of the phone was in your house (and the phone itself wasn't stolen, along with six others in his possession),
Does your rural PD actually have any digital forensics experts on staff, and
Even if they did, would they actually do anything with this evidence?

I've seen cases where burglars left visible fingerprints and other more low-tech evidence at the scene, which went ignored by investigators. Your solution, while clever, would probably not be sufficient evidence to convict anybody. Your money would be better spent on infrared CCTV. Juries are much more easily convinced by video evidence than long explanations about hexadecimal numbers.


ModSecurity - XSS not blocked when #/ (hash) is added in the url by NodeJS application I have installed ModSecurity in Apache server and using it as a reverse proxy to forward request to a NodeJS applicaiton.
I have followed this tutorial to configure ModSecurity in Apache, https://www.atlantic.net/vps-hosting/securing-your-apache-web-server-with-mod-security/
I then enabled SecRuleEngine and set it value to On.
Upon starting Nodejs Application and Apache Server with ModSecurity I can see that requests are routed to NodeJs application.
However, the nodejs application is adding #/ at the end of the domain i.e it becomes http://test.com/#/
SQLi
I tried performing SQLi by simply running ' or 1=1; -- for Username in a login field. Which is blocked by ModSecurity and I get Forbidden page.
XSS
When I visit,
http://test.com/#/%3Cscript%3Ealert(%E2%80%98XSS%E2%80%99)%3C/script%3E

ModSecurity doesn't block it, However If I remove #/ and visit
http://test.com/%3Cscript%3Ealert(%E2%80%98XSS%E2%80%99)%3C/script%3E

ModSecurity blocks it.
Can someone please help me understanding how to use modsecurity when NodeJS adds #/ in url?

A URI fragment is never actually sent to the server by a well-behaved client, it's only meant to be processed client-side, where Apache and ModSecurity can't see it.

The fragment identifier functions differently to the rest of the URI: its processing is exclusively client-sided with no participation from the web server, though the server typically helps to determine the MIME type, and the MIME type determines the processing of fragments. When an agent (such as a web browser) requests a web resource from a web server, the agent sends the URI to the server, but does not send the fragment. Instead, the agent waits for the server to send the resource, and then the agent processes the resource according to the document type and fragment value.
URI fragment - Wikipedia

Because of this it wouldn't really be possible to perform SQLi using a URI fragment (except maybe by a badly-behaved client and a poorly-programmed server).


How can I tell if a PDF file I was sent contains malware? I was emailed a PDF file by a family member. I have reason to suspect that it was given to said family member by someone who would like nothing more than to infect me with a Remote Access Trojan. How can I tell if it contains code that would allow an attacker to gain access to my Android phone?

You can upload a pdf to VirusTotal and check if that file is infected, but be careful since results from VirusTotal are not 100% accurate.

There is also PDF Examiner.

  PDF Examiner by Malware Tracker is able to scan the uploaded PDF for
  several known exploits, allows the user to explore the structure of the
  file, as well as examine, decode and dump PDF object contents. This
  tool lends itself well to manual PDF analysis tasks. In this way, it
  differs from Jsunpack and Wepawet, which focus on automating the
  analysis as much as possible.

One more free service Jsunpack.

  Jsunpack by Blake Hartstein is designed for automatically examining
  and de-obfuscating JavaScript. Its features also include carving
  contents of network packet capture (PCAP) files and identifying common
  client-side exploits. It can also examine PDF files for malicious
  JavaScript artifacts.

For deeper analysis you should check PDF tools from Didier Stevens.

https://blog.didierstevens.com/programs/pdf-tools/


SIEM Question: Excessive Firewall Denies / Rule Edit Question We have a SIEM in our environment that we're currently tuning and part of that process is reducing the noise in our console.

One offense I've been working on is: Excessive Firewall Denies Between Hosts containing Session Denied.

The rule that is triggering from the traffic and generating the offense is: Anomaly: Excessive Firewall Denies from a Single Source. The rule is constructed as follows:

- and when any of these BB:CategoryDefinition: Firewall or ACL Denies with the same source IP more than 400 times, across exactly 1 destination IP within 10 minutes

I took a sample of 10/20 offenses and looked at the traffic and confirmed the traffic is hitting our external interface in the DMZ and it is being denied by our firewalls. No allows.

Since we are generating a lot of noise in our console, I raised the timing threshold in the rule from 10 minutes to 15 minutes which was still triggering offenses. I then upped it from 15 minutes to 30 minutes.
+
My question is, since the denies we are seeing are legitimate denies, should I increase the threshold of time and/or instances for the rule to trigger an offense so I only see a sustained attack to our public facing IP's? What risks would incur if I made this change, if any?

Thanks for the assistance!

This looks like a QRadar rule. It would be good to ask the question on the IBM developer forums as you will have more QRadar administrator eyes on it.

That being said, firewall denies are inevitable if you have a DMZ. The flaw is that many people look at just firewall denies, but do not look at firewall permits. Denies are only affirming what you hope to see. The permits are where the real danger lies.

For misconfigured services:

If the denies are related misconfigurations or known services, either fix the services or add them to the false positives list.

For any non-legitimate services or malicious network scanner:

Create a rule that catches more than X number of firewall denies in X minutes (These are numbers that you should be comfortable with). Then use that rule to add offending source IP to a reference set (For example, call it: Reference Set: Malicious Scanner). Finally, create another rule that checks for BB:CategoryDefinition: Firewall or ACL Accept (assuming you are logging permits) and checks against the Reference Set: Malicious Scanner. When a firewall permit is logged from an IP in the Reference Set: Malicious Scanner, a new offense should fire. This way, you are catching when a known-suspicious IP address manages to successfully get past the firewall.

If you are not logging permits, but are using netflow data, create a flow rule that checks against the Reference Set: Malicious Scanner for any traffic that does not hit the DMZ network. This may help you identify if an IP manages to bypass the firewall. Netflow data is not as accurate as logs.


How do SRP (and PAKE generally) protect against verifier leak I have been reading into PAKE protocols, specifically starting with SRP RFC2945

The gist of the requirement on the server is that the server saves triplet (username, verifier (v), salt (s)) in the credentials table.

Where verifier v = g^x % N (the ^ operator is the exponentiation operation)
and x = SHA(<salt> | SHA(<username> | ":" | <raw password>))

Now during the authentication dance, the client obtains the salt (s) from the server and computes the same verifier (v) that the server is using. It can compute this value because it collects the username and password from the user themselves.

In the next few steps the client can subtract the component v from the servers challenge B = (v + g^b) % N and arrive at a key derived from S.

Client: S = (B - g^x) ^ (a + u * x) % N

My question is that if someone hacks my database and dumps the credential table with (username, verifier (v), salt (s)) they immediately have access to all verifiers for each username. Then what stops them from using the obtained verifiers to imitate a client and complete the client side authentication steps? So instead of computing the verifier (v) from the real username and password, they can simply use the verifier obtained maliciously from the server to continue the client side computation and arrive at the same key as the server.

i.e. In my reasoning if my server is hacked and credentials leaked the end result is no better than if I were saving plain text passwords.

Disclaimer: I admit I do not understand fully the maths but generally the concept that such crypto protocols rely on the property of exponents that (g^a)^b = (g^b)^a = g^ab

Even if an attacker breaches the server database, and obtains the userid (u), verifier (v), and salt (s) for a client, the attacker would not be able to use this information to login as that client.

See https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol.  Step 4 is where the client computes the client session key, as follows:

S_c = pow(B - k * pow(g, x, N), a + u * x, N)   [eq 1]

The verifier was previously calculated as:

v = pow(g, x, N)   [eq 2]

So, knowing the verifier, the attacker could re-write eq 1 as:

S_c = pow(B - k * v, a + u * x, N)   [eq 3]

B was previously sent from the server, k and N are constants known to both parties, a is computed on the client side, the client has everything he needs to calculate u, v was obtained from the server in the breach - but what about x?  Before calculating the client session key, the client must first calculate x as follows:

x = H(s, I, p)   [eq 4]

where s is the salt (obtained from the server in the breach), I is the user id (also obtained from the server in the breach) and p is the password.

Without the password, the attacker cannot compute x, therefore the attacker cannot compute the session key.  Without the session key, the client cannot authenticate with the server.  So knowing u, v, and s for a client is not enough for an attacker login as that client.  The attacker must also know x, which is calculated from the password.

However, x is equivalent to the plaintext password.  This is why the client should not store x.


Multiple Bank Accounts on one payment gateway or merchant account I'm looking to use PCI compliant payment gateways such as Authorize.net or Spreedly.com in my website. However in my particular case (hotel, tour, events reservations), we will serve as an intermediary for our clients for collecting and storing Credit Card Data (which will be done by these Payment Gateways).These clients may then charge or not these credit cards in a given amount of time (mostly one-off payments). Basically what booking.com does when they allow you to make a reservation with your credit card as a guarantee.

In this regard, it is common to allow the client to access the Credit Card Data once the client decides it must charge the customer, however, I would prefer that our clients have no access to the credit card data directly. Instead they would be allowed to charge them through our system .

Is it possible that once they charge and the payment gateways processes the payment for it to be forwarded to each specific client bank account.

The problem is that we don't want to handle receiving money and then distributing it to our clients, we want them to receive their payments into their account themselves.

Of course, we would handle their bank account data securely through Authorize.net CIM or Spreedly's Vault service.

Finally, the question is: Is such a scheme possible? that I could redirect payments received through a gateway to different bank accounts (potentially hundreds) depending on the transaction? Mind you, I'm not asking for split payments, there is only one and only one recipient per transaction, but given the kind of thing the customer is purchasing these recipient may vary.

Sorry for the long post and thanks in advance.

I think you're interested in being a PayFac:

Provide payment transaction routing
Settle to sub-merchants

And use tokenization to avoid holding card details.

I think PayFac is a Vantiv-specific term, so you may want to look at the bullet items on that page and try to match them to the processor you're using, to determine if they have an equivalent.


Can ICMP Redirects still be used to redirect traffic in a LAN? I tried just tried to migrate a MITM attack using hping3 with ICMP Redirects in my testlab.

hping3 -I eth0 -C 5 -K 1 -a 192.168.2.1 --icmp-ipdst 192.168.2.15 --icmp-gw 192.168.2.100 --icmp-ipsrc 192.168.2.105 192.168.2.105

I'm at 192.168.2.100, the victim is at 192.168.2.105, the DNS-Server is at 102.168.2.15 and the (real) gateway is at 192.168.2.1. Now I wanted to bring the victim to redirect all traffic for the DNS-Server through my Laptop. The generated packets look well in wireshark but the Vicitim (Windows 7) isn't changing its routing table based on the redirect packet.

I looked this up and found some posts implying that Windows 7 in general does not accept ICMP Redirects as an advice for routing. Are there any current Operation Systems that still accept ICMP Redirects?

ICMP redirects have been disabled in many Windows XP and Windows Server 2003 environments since the introduction of the first service packs. You might find it in legacy Windows infrastructures, but I doubt you will find it in Vista-era or later.

To detect whether or not ICMP redirects will work on any given network, use the Responder.py tool in "Analyze Mode" as seen in the fifth section of this blog post -- https://www.trustwave.com/Resources/SpiderLabs-Blog/Responder-2-0---Owning-Windows-Networks-part-3/

Best would be to use a tool such as EvilFOCA, or to see this other StackExchange post on using dns2proxy with sslstrip2. Many of these techniques will provide MITM conditions.


Does clicking "no" to "Do you want to allow the following program ... to make changes to this computer" mean I'm safe? I recently got an unwanted exe automatically downloaded by my browser, and on going to delete it my useless trackpad registered misplaced my click and I ran it. I got the usual dialog about making changes to my computer, and selected no. The program ran anyway, and I immediately closed it. It left me wondering whether I had compromised my machine, which in turn led me to a specific and concrete question of general interest...

Does selecting "no" on "Do you want to allow the following program from an unknown publisher to make changes to this computer" dialogues actually prevent programs doing any damage, or does it just protect a limited part of my system? In what way and to what extent does this choice protect me from malicious software?

Clicking "no" on a prompt like that, usually means the program will still run, just not with administrator level privledges.

If the program was trying to access a directory which required admin privileges (such as Program Files) it would then crash, or re-prompt you.

The program can still access the files which your account has access to. For example: theoretically a piece of Ransomware which encrypts only your documents and pictures could still do it's job without being granted administrator privileges, as it's only interacting with files your standard user account has access to.

It's rather odd that your browser "automatically download an unwanted exe." That's usually a result of being on a dangerous website, or already having a piece of malware on your device.
I'd recommend running a full scan using your antivirus. If you're extremely concerned, you could revert to a restore point before you downloaded the program.


How does websocket frame masking protect against cache poisoning? I've been studying the Websocket protocol (RFC 6455). Section 10.3 specifically talks about frame masking, which is prevents cache poisoning from http proxy servers.

How does frame masking prevent cache poisoning? How is a proxies cache "poisoned"? Why is the masking only applied to messages from the client to the server and not also the other way around?

Can this attack also be applied to long polling methods as well (specifically XHR)?

That's a lot of questions. We'll stick just to the core problem and mitigation technique:

There's the chance that my connection may be proxied or otherwise examined by a caching proxy. And there's a decent chance that I can fool the proxy if I can get the right data into my request and the desired data into the response. The basic idea was demonstrated in a paper called Talking to Yourself for Fun and Profit.

As an attacking client, what I want to do is push content up to the server that contains a seemingly valid request string:

... something ...

GET /jquery-latest.min.js HTTP/1.1
Host: code.jquery.com
...
... something that triggers the desired response from the server

The only requirement is that you figure out a way to get the server to send you a desired string, which typically isn't too hard. Then the server predictably parrots back the desired response:

HTTP/1.1 200 OK
content-type: text/javascript

... my trojaned javascript file

As far as the server and client are concerned, we're just passing strings back and forth. No real reason for concern, no harm done, no possible vector for exploit.

But a proxy watching the traffic would see what looks a lot like an HTTP request, and then what looks a lot like an HTTP response. And if the proxy is naive enough (and many are), it will update its cache accordingly, so that the next time someone requests http://code.jquery.com/jquery-latest.min.js through the proxy, they'll get my trojaned version instead of the real CDN-delivered code.

To guard against this, the traffic in one direction (in this case client-to-server) is mildly scrambled. It doesn't have to be cryptographically secure as you don't care if someone can decode it. You just need to make sure that the client can't predict what string he'll be transmitting over the network. And since he can't predict his network traffic, he can't use this mechanism to trigger a proxy server to update its cache.

The proxy will only see a cacheable event if BOTH the request AND response contain what looks like HTTP traffic. So only one direction need to be jumbled.

This does not apply to XHR, since XHR requests are "normal" HTTP requests, and are well-understood by proxies.


Are subdomains secure from one another if they are on separate servers? I'm writing an application (example.com) that gives users their own sub-domains to run arbitrary user applications off of (user.example.com).

Each user application will be run on separate servers with distinct domains, and my application will route user.example.com to users-app.com.

Are my users able to compromise each other? What about the parent domain example.com?

Quick answer: Probably yes

Domain and sub-domain names are just pointers to where your application resides, or at least, where it can be reached if you've put additional proxies in place.

So the real question is what stops anyone compromising any of your users at the application level?

There are plenty of exploits and developer errors to get around what browsers should enforce when communication with hosts, and attackers can always go after your servers directly.

So yes, if you screw up your application design or implementation badly enough, using sub-domains isn't going to magically save you. I would also suspect dedicated servers per customer isn't going to scale too well either, but that's a different issue.


Burp Suite Proxy Doesn't Forward Any Packets I'm trying to capture data from my iOS device (specifically a troublesome app) and when I configure it to use my laptop on the same wifi as a proxy, I lose all connectivity.

Here's what I did in Burp Suite Free (v1.7.16):

Turn off intercept (So the button reads Intercept is off)
Under Options, disabled Run on the loopback listener.
Added a new listener: All interfaces, port 8080. I left the remaining options defaulted.

On iOS:

Added my laptop's IP address as the host, and port 8080 as the port.

It seems like no traffic at all is getting through, whether SSL or not.

Quick edit : The firewall is disabled on my laptop.

Set Burp proxy (you can leave the loopback alone for other tasks) all interfaces to a port like 8082. Set your iOS device internet options to proxy to your Burp proxy IP/port. Don't forget to install Burp's certificate on your iDevice for SSL. It'd be the same for Android or any other device.


Are Citrix Netscalers vulnerable to shellshock bash command? My enterprise environment is "protected" with reverse proxies, how safe am I?

Netscalers appear to be vulnerable!

Netscaler is running GNU bash, version 2.05b.0(1) , which is stated as vulnerable in http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6271

Here is what I get:

root@ns# env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
vulnerable
this is a test
root@ns#

Response from Citrix on the ticket I raised:

" I would like to inform you that our security team is looking into this issue and this is under investigation, we are expecting an Update soon on this. "

while we wait for official fix release from Citrix you might have to use your IPS (in my case palo alto) signatures to deny such attacks for remote websites and keep watch/restrict management access on Netscaler .


What are the differences between DIACAP and RMF? I am currently certifying systems (products) under DIACAP (DoD Information Assurance Certification and Accreditation Process). In the future we will need to use RMF (Risk Management Framework).

What are the key differences between these two processes?
What are the similarities (for instance they both use a POA&M)
Is there a defined, documented transition from the older process to the newer? (Something with more meat than the slides at http://csrc.nist.gov/groups/SMA/ispab/documents/minutes/2012-10/ispab_oct2012_dcussatt_dod-rmf-transition-brief.pdf)
Has the reciprocity aspect of RMF worked in practice, between different branches of the DoD and or services?

Concept of Operations (CONOPS)
Ports, Protocols, & Services Management (PPSM)

Hardware / Software list
Network diagram

System Security Plan (SSP) / Application Security Plan (formerly DIP/SIP)
Security Assessment Report (SAR) aka. Risk Assessment Report (RAR)
Information Security Continuous Monitoring (ISCM) Plan
Plan of Action and Milestones (POA&M)
Configuration Management Plan (CMP)
Configuration Control Board Charter (CCB)
Incident Response Plan (IRP)
Rules of Behavior (ROB) / Acceptable Use Policy (AUP)
Systems Administration Manual (SAM)
Continuity of Operations Plan (COOP) or Business Continuity Plan (BCP)
Disaster Recovery Plan (DRP)
Contingency Plan (CP)
System Level Agreements (SLA), Memorandum of Agreements (MOA) or Memorandum of Understanding (MOU)

DIACAP to RMF artifact differences:

SSP replaces System Identification Profile (SIP) and DIACAP Implementation Plan (DIP)
SAR replaces Scorecard, Evaluation Risk Report (ERR)
Security Control Assessor (SCA) replaces Validator or ACA
Security Authorization Package (SAP) replaces DIACAP Package
Information System Security Officer (ISSO) / Manager (ISSM) a replaces IAM / IAO


Is using the same password for multiple TrueCrypted volumes safe? I want to use TrueCrypt for encrypting multiple disk volumes.

Assume I use the default cryptographic algorithm (AES) and hash algorithm (RIPEMD-160) and that nobody can get my passwords through alternative means such as keylogging etc.

Is it considered safe to use the same password for multiple volumes? Or will an attacker with access to my encrypted volumes find it easier to crack my password if he knows that the same password is used for all volumes?

Using the same password for multiple volumes gives an attacker more information to crack your encryption, so it is bad practice from a cryptography standpoint. Password and key re-use has historically been used to break encryption schemes in the past.

In your case I'd argue that the difference is moot, as anyone who would actually be able to take advantage of you using the same password for multiple volumes would have to be extremely sophisticated and have access to a whole lot of computing power. Anyone that sophisticated would almost certainly have other means to discover the password rather than attacking you cryptographically, they'd simply hack your computer, plant a camera in your home, etc.

It's still a bad idea to use the same password though as you're probably aware.


Why is it dangerous to let an internal server talk to the internet (to a specific IP)? Sort of a basic question, but if we have an internal server and want it to talk externally, for example to get new packages. This environment normally does not have access to the internet. I've heard it's "dangerous" to open access from that server to even a specific IP on the internet (let's say where ever it needs to get its updates from). The point is- we know what the IP on the other side is and I would assume we trust it.

Realistically, what is the risk when it can only talk with that IP it will get new packages from?

Not a security person here- just trying to understand!

It is no more dangerous than allowing a desktop to access an IP when they are browsing the Internet. It would be dangerous to assign a static IP, have insecure services exposed. Two separate issues. When you connect to the Internet from a business or a home network, or any network for the most part, chances are you will have a firewall somewhere in the loop. Whether it is a dedicated firewall, or minimalist fw like rules applied on a router. That router is your egress point to the world. So this is what occurs when you connect, and how the world sees you:

Router - 10.10.10.1 (internal address) / 33.33.33.33 (external address)
Laptop1 - 10.10.10.2
Workstation1 - 10.10.10.4
DBServer2 - 10.10.10.10

Let's say a user on Laptop1 goes to get an update at say: mysoftware.com, this is what occurs very basic terms:

Laptop1 --> need to go to mysoftware.com (DNS lookup) --> router

Your router creates a tuple (NAT/PAT) to pass it to the world which may look something like this:

10.10.10.2:65432 --> mysoftware.com --> router (I need to remember this)
router --> 10.10.10.1:44555 / 33.33.33.33:554433 --> mysoftware.com "Hey I need this"

Imagine if two people at the same exact time went to mysoftware.com how would data know which machine is which? This is done by the tuple so on the way back this occurs:

mysoftware.com --> here is your update --> 33.33.33.33:554433

Your router/firewall now maps back that tuple:

554433 = 44555 which I have mapped to 10.10.10.2:65432

That is how connections work in a nutshell. Now, under the same ASCII explanation... The outside world can NEVER randomly see what is behind a firewall (unless the fw is misconfigured, and someone does some really good firewalking). So what is perceived will occur by allowing this system to access the Internet? Remember, there is a difference between assigning that machine a STATIC IP where the world can see it, to just giving it access.

So let's assume this is a MySQL server:

Workstation1 - 10.10.10.4 3306 is opened for LOCAL connections (within the LAN)

An attacker? They won't know the 10.10.10.4 address exists. In the world, all they know/see is 33.33.33.33 they can send data to 33.33.33.33 port 3306 but it will end up nowhere.


Android hardware Keypair Info Basically I would like to use Android Keystore to sign requests going to a server from an Android phone. My goal is to have a way of verifying the origin of the request.

Does Android Keystore offer anyway for the receiver of the request to verify that a specific key came from Android Keystore with a specific hardware/device ID rather than a keypair generated from OpenSSL, for example.

It doubtful that your signing protocol can convey that metadata. As far as is documented, the public key of a keypair generated in the Android keystore contains no telltale patterns that would identify it as such, nor would such a feature necessarily be desirable from a security standpoint. Finally, such metadata would itself need to authenticated to be relied upon, which creates a very complicated trust structure that would be hard to maintain. – James K Polk Nov 5 at 20:09


Orbit Downloader botnet program removal [solved] Recently (shortly after midnight on 10/8/2013) I installed and ran Orbit Downloader. After learning that the latest version  (4.1.1.8) has a botnet-like module included I immediately stopped the program and uninstalled.

In total, the program could only have been running for a few minutes (5 max) after installation. I have disconnected the computer from my home network, deleted all files it installed and came with, did a system restore to October 4th, and am currently running an avast boot time scan.

Are there any other steps I should take to assure that the program is is gone and can no longer cause any harm?

Is there any way to see now if my computer took part in a DDoS attack, or what the Bot-net could have done?

Source of info on the botnet-like module: http://www.welivesecurity.com/2013/08/21/orbital-decay-the-dark-side-of-a-popular-file-downloading-tool/

System specs: windows 7 (last update on the 4th), model is a Z570 (10249BU) (http://www.newegg.com/Product/Product.aspx?Item=N82E16834246156)

Update: avast has nothing to report

System restore is almost enough . And since it has been discovered it has been flagged by almost every AV so yeah don't worry about it .


How confident is MIME blacklisting on a proxy server? We are blacklisting a number of MIME types on our proxy server so users can't download certain file types, for example, executables.

Could it be possible that somehow, a malicious server can trick a user (maybe through script exploits or drive-by) to browse and download a malicious executable, bypassing the blacklist? Let's assume the proxy server only allows HTTP traffic.

On older browsers, the answer is yes, this kind of attack is possible, due to some browsers' support for MIME content-type sniffing.  You can Google for content-sniffing attacks and you'll find a lot more details.

To defend against it, set the header X-Content-Type-Options: nosniff (only supported on IE8 and IE9, I think), and make sure to serve a valid content-type in the Content-Type: header.  Those will disable content-type sniffing on many browsers (on IE8, IE9, and non-IE browsers, at least).

See also
Using file extension and MIME type (as output by file -i -b) combination to determine unsafe files?,
Does X-Content-Type-Options really prevent content sniffing attacks?,
What are the security risks of letting the users upload content to my site?,
How can I be protected from pictures vulnerabilities?,
Is it safe to serve any user uploaded file under only white-listed MIME content types?,
MIME sniffing protection,
Why should I restrict the content type of files be uploaded to my site?.

I also recommend that you serve user-uploaded content from a separate domain, to sandbox the user content and ensure it cannot tamper with your content.  For instance, you might host your content on www.example.com and host user-provided content on uploads.example.com.

Update: I just learned that setting the Content-Type and X-Content-Type-Options headers are not enough for security.  Apparently, Flash ignores the Content-Type header, which could allow loading a malicious SWF, which can then do everything you'd do with a XSS.  (Sigh, stupid Flash.)  Unfortunately, no amount of headers can stop this attack.  Consequently, it appears that the only safe solution is to host the user-uploaded content on a separate domain.


On my website's account creation form, how to avoid leaking the information that an email address already has an account? It seems common practice, when denying access to a user because of an incorrect email / password combination, to not specify which of the username or password was incorrect. This avoids leaking the information that an account does or doesn't exist with that email address.
For instance, if I try to log in with my spouse's email address on a dating website, and the error message is "Incorrect password" rather than "There is no account with this email address", I can draw the necessary conclusions.
But how do I avoid that same information leak on an account creation form, where I must prevent a user from creating an account with an email adress that already has one?

I'm probably stupid and don't understand the issue, but to me it looks like the problem can easily be avoided by providing the necessary information only via email (which an attacker isn't supposed to be able to access). If you don't want to leak any information, then the public messages must not be distinguishable, whether an email is already been used or not. If you really want to be careful, technically, you should also make sure that the response time is the same, to avoid timing attacks. But this, depending on your needs, might be overkill.
So what happens is:

If the email has not been used yet, you display a message like "Thanks for registering, now go check your email to complete the process". The email will contain a link to validate the address, and when the user clicks it the account will be created and enabled. You can also create the account at once, before validation, but you will need to make sure an attacker cannot check if it's been created or not (otherwise that's information that is leaking).

If the email has already been used, then you display the same message (see the point above), for example "Thanks for registering, now go check your email to complete the process". This way an attacker will not gain any additional information. Is the email address already been used or not? The attacker can't know, unless they can read the email. But the user will know, because the message you will send via email this time is different, and it might be like: "You just tried registering at example.com with this email address, but you already have an account connected to this email address. Did you forget the password? Blah blah blah. If it wasn't you, just discard this mesage".

As a result, an attacker will not be able to understand if an account has been registered with a specific email address, unless they have access to that email address. A user, instead, since they supposedly have access to the email address, will be able to get all the information they need, whether they signed up correctly or they tried to sign up twice.


What are security best practices and compliance areas in Agile Software Development process How do you ensure on a high level that developed software is secure and compliant.

We want to introduce a service checklist that will list each item, including "Security and Compliance" section.

It will have things/requirements like:

No plain-text secrets are present in the source code.
Any sensitive data can only be accessed after authentication/authorization, with the principle of least privilege in mind.
Any production credentials are strong and unique.

etc

The problem is that I realized the highest assurance you get asking more questions i.e hence the OWASP Application Security Verification Standard with 68 pages.

How do you balance this?

Question is:

Any standard? Checklists available online? Any tips on approach?

What core requirements do come to your mind to check the software for security and compliance in agile development?

As I said I think it is tricky, since we dont want to have it too big, nor too small (i.e is software secure? yes/no)

I hope you get my point.

Your question is a little confusing because it asks how to do this in Agile Software Development but then asks for examples of items to check. The second question seems very specific to context and since you are already looking at OWASP documents, you probably have plenty of examples. I can help with the first, but before I do, a short caveat: there is no such thing as an Agile Software Development Process. Most people, when they say this, mean they have a development process built around the Scrum Framework, so I'll assume for this answer that this applies to your team. Even if it doesn't, most of the answers wouldn't change much.

To ensure the most secure application possible, here are a few things that typical Scrum teams do:

1) Exactly what you are doing - agree upon a security standard. This should be something that all team members agree to follow.

2) Scrum has something called a Definition of Done. It is a set of quality measures that every item must meet to be considered done in a Sprint. Compliance to the security standard should be on that list.

3) Like any quality concern, security is everyone's problem. People should be discussing it in code reviews, architecture reviews, etc and it should be worked into code analysis systems and deployment processes.

4) Separation of responsibilities (between people and roles) in certain areas can contribute to a higher level of security, but it can also cause problems. Allowing only one person to have an account to a server reduces a number of people to be compromised, but also creates a bottleneck. If that bottleneck becomes an impediment to business goals, people start looking for ways around it and that opens more security risks which are harder to manage because you don't know about them. In short, security that relies strictly on rigid control is often broken, but the problems are hidden.

5) Build quality (and security) in. Better than controls, build good habits in your teams. This can't be done with a policy, this is done with culture. Leaders have to encourage people not to cut corners to make deadlines. Leaders and influencers in the organization need to visibly show that it matters to them, then your engineers need to build a habit of working in a way that is more secure. This takes months, if not years, but the pay-off is immeasurable. If you succeed here, then anything you do "checking" for security risks only has to catch human error, which is far easier and a far smaller set of problems than human negligence or neglect.


DMZ an additional router Recently I had an idea to test use a server (with ubuntu) and I need it to be accessible from the outside with port forwarding.

I'm not often at home, but the internet provider doesn't like their customers to mess around with their routers. Because of that, they change their passwords daily.

I can access the router because I have a "friend" that can give me the access, but I don't want to bother him every time I want to make a change.

I was thinking on setting up an additional router, DMZ its static IP, and from my personal router, open the ports I need.

Is this a good or bad idea?

When you can configure the ISP router to run in bridge mode and connect a second router behind the ISP one, you can manage all your port forwarding rules yourself.

Make sure that DHCP is disabled on the ISP router and enabled on your own router. This might be done automatically when the ISP router is put in bridge mode.

  Is this a good or bad idea?

This depends on how you configure your own router. Exposing the administrative interface over the internet for example is something you probably don't want to do. You are required to manage your own router, check for firmware updates etc.

Additionally, it might (or might not) violate your ISP's policies. Your "friend" most likely is violating his employer's policies.

Since your ISP limits you in exposing external services, you might want to consider changing to another ISP that does not limit you.


What attack modes does a VPN secure against over https? Suppose all my sensitive traffic is handled over a https connection. Further assume, I've no interest in hiding which sites I visit just want to hide the sensitive contents. i.e. If an adversary knew the fact that I did a dns lookup for foobar.com that doesn't affect me.

Now is there any special advantage to using a VPN?

I mean there's a distinction between anonymity vs security right? If I want anonymity I might use something like tor.

If I want to access geo-restricted content (say) then I might see why I would use a VPN that makes my traffic seem to originate for a US IP even if I am located in (say) Saudi Arabia.

Or if I want to access legacy software that only works over the office intranet and it's rather simple to make it seem like my remote laptop is virtually within  the office intranet than to go about modifying all legacy software individually.

But other than these use cases is there any fundamental benefit to using a VPN over just https?

If all you do is surfing the web and all the surfing you do is already protected with https and you only care about encrypting the traffic but don't care that somebody might see which sites you visit and when and if you can be sure that your https is not intercepted by some local antivirus, local malware/adware or some enterprise firewall or you don't care, then it is enough to use https.

If any of these conditions are not met a VPN might make sense depending on what you do. And note that a VPN is no replacement for https: https provides end to end protection while VPN offers no protection after the traffic leaves the VPN endpoint which is usually not the endpoint of the connection.


Is Bitlocker secure enough for portable storage devices? I have recently lost a USB flash drive that contained some important information. Fortunately, it was protected by Bitlocker. I felt the impulse to ask exactly how secure it is.

Most answers on this site related to Bitlocker seem to be about built-in storage on a computer. This answer says there was a possible cold boot hack. Is it more secure to protect a USB flash drive with Bitlocker, since you cannot use that kind of hack on a USB flash drive?

Also, that answer is 6 years old. There must have been some new developments. With the current technology that Bitlocker uses, do I need to worry that the information on my USB flash drive could be decrypted?

A cold boot attack is impossible on an offline device. The only way an attacker could use a cold boot attack on your portable storage device is if they also had physical access to your computer as it was plugged in the disk unlocked.

A cold boot attack relies on encryption keys being stored in RAM, and the persistence of that RAM once the computer is hard reset.

In short, you shouldn't worry too much unless there's a nation state after your data. Even then, I'd trust BitLocker unless there's a backdoor.


Is Access Control Through MAC ADDRESS a practical/secure solution I run a small local gaming website with a custom admin panel I coded to let trusted members do administrative tasks through the software's API. Since their IP Address is dynamic, can I authenticate them to the admin panel through their MAC ADDRESS ? Or any other practical solution.

Note: I run a windows server 2008 R2 with PHP installed.

My ultimate goal is to block access to anyone other than the trusted members. So anyone sniffing for the password or even the url of the admin panel will be blocked.

MAC addresses are completely spoofable.

MAC addresses are not visible to servers over the Internet. They're only visible to computers to which your computer is talking directly over an Ethernet wire (such as your router).

So no.


PCI prohibit direct outbound connections on EC2 I am using EC2 instances to power our web service that needs to be PCI SAQ-C compliant.  I am trying to figure out what point 1.3 of the self assessment really means:

1.3 Does the firewall configuration prohibit direct public access between
the Internet and any system component in the cardholder data
environment, as follows:

1.3.3 Are direct connections prohibited for inbound or outbound
traffic between the Internet and the cardholder data
environment?

1.3.5 Is outbound traffic from the cardholder data environment to
the Internet explicitly authorized?

1.3.6 Is stateful inspection, also known as dynamic packet
filtering, implemented (that is, only established connections
are allowed into the network)?

Since I am on EC2 a DMZ is not really an option because all instances have a public IP.  I have been searching for several days on the web trying to figure out what this means and what I need to do to comply, but I cannot find anything.  This is probably in large part because I have a programming background not security, or system administration.  So I am guessing I am looking in the wrong place.  But, I am not sure what the right place is.  So, if you can recommend a resource that would explain this in more depth, or software that will fulfill this requirement, I would appreciate it.

Section 1.3 is intended to prevent repositories of sensitive information (in PCI DSS world - cardholder datastores and processing engines) from being able to either offer an internet-facing service, or push data directly out of their store to the internet.
The concept behind the first part is to minimise the attack surface available to an unfriendly outsider, and the second part is to provide some defence in depth, so that if a breach occurs, there is a barrier to an attacker simply piping data out to their location.

As with a lot of PCI DSS, if you can avoid storing data post-authorisation you will save yourself heartache (and costs). It might be worth considering whether you can get the results you want using a payment service provider like worldpay instead of rolling your own payment system.

A lot of "reference sites" to PCI DSS are simply vendors looking to push their products as the solution to PCI DSS (tip: they are not, usually), however the PCI Council is worth reading through, as is Amazon's AWS Reference (since you are using EC2)


How do location-based apps avoid getting cheated by emulated GPS? Some apps like Foursquare require the user to "check in" at physical places, in order to gain money benefits.

Given that emulated GPS are available for customized versions of Android, it sounds easy to trick such apps.

Given the monetary incentives, I am sure many people have tried, so how do apps prevent GPS cheating?

There are many ways to track user's location on a mobile device (I will go into how that works later).

None of the tracking methods are particularly easy to spoof. It can be done but it is simply outside of the realm of the average user as it generally requires either a modified device (physically or programmatically) or external gear.

Moreover, it is far easier for developers to simply tie multiple forms of tracking with simple logic (IE you can only 'check in' x number of times within timeframe y) than it is for a hacker to spoof an app like foursquare and get that 5% discount on dinner. Once again, it can be done, but [my theory is] so far it is not economical to hackers.

As promised, here are a few of the big technologies leveraged in geographic tracking:

GPS Reporting. This is probably most familiar to you. It is the most 'expensive' report because it requires relatively large amounts of power to read several GPS satellites. A pure GPS system is rarely used on mobile devices today. GPS devices can be spoofed programmatically (by changing the software's call to the GPS driver's position) even without modifying a device at all (as seen here).
GSM Reporting. This is perhaps the most common way your location is tracked through the day while you are moving around. The concept is simple. Your phone, with normal messages to the cell towers nearby, triangulates your position at a given time. This method is extremely hard to spoof without external hardware or seriously altering your phone's functionality (IE if you spoof a cell tower then yes you are 'not tracked' geographically, but you also cannot make phone calls). Additionally, cell traffic is encrypted. You could potentially spoof the access point where the apps software talks to the phone's cell tower data driver, but that is also difficult to say the least.
LAN Reporting. This is a pretty cool concept because it provides high levels of accuracy indoors (something that has traditionally been an issue). This requires much setup but at a minimum would allow apps to talk to registered wifi hotspots to confirm your location based on which wifi you are connected to. This is theoretically possible to spoof but it would largely depend on the levels of encryption for the legitimate connection's signature.
WAN Reporting. This is nothing more than simple IP address reporting. This is perhaps the easiest to spoof, but I put it in here for completeness as it is very common to mobile friendly sites.
Others (Bluetooth, RFID, Inertial nav, experimental, etc) There are quite a few other methods out there. One of my favorites is Inertial Navigation where there are no external transmissions (thus potentially very difficult to spoof) as it uses internal sensors and map to ascertain your position. This is seen in missile guidance systems as well as some apps. Life360 for instance uses a variation of this as it uses very little power (all the sensors are already active).

Other things to remember:

Developers can leverage any number of these technologies, thus making an app even harder to spoof.
Most location data is stored on a mobile device (and sometimes in many places) until explicitly deleted. Thus a developer can (potentially) access previous location data points. So if you say you were at cafe mama's 20 times todays and the app simply talks to siri to find out your last geo-data point was 100 miles away, the app will wonder...
Law Enforcement would have far greater ability to determine your real location so just because you may have spoofed an app doesn't mean you should bet your life on it (some comments elsewhere suggested that you could use this spoofing nefariously, so I thought I'd toss this in here).


Response on targeted attacks against an individual I'm now an aim for a targeted attack. Someone tries to gather information about me and tries to get access to my accounts. Some time before he/they've managed to succeed (got all the info from my email and restored passwords to accounts through it, but I don't know how they got the access to my email because the password remained the same and it has not been used anywhere else). Of course, the security log showed that they have been using Tor.

I regulally get emails that someone was trying to restore a password for one of the services I was signed up.

Now I've found a strange behavior on one of the services I'm signed up. It seems they have managed to get access again. Also I got a message from Facebook that someone was trying to enter my account. This means they know my email address and now they know my name (FB used to be disclosing it if you try password recovery or fail to sign in several times).

How to deal with this threat?

Format your hard-drive, reinstall your OS of choice and then reset all your passwords online.


What is the benefit of having a cryptographically secure hash algorithm in hashmaps? I recently read the Rust language documentation and saw this:

  By default, HashMap uses a cryptographically secure hashing function that can provide resistance to Denial of Service (DoS) attacks. This is not the fastest hashing algorithm available, but the trade-off for better security that comes with the drop in performance is worth it.

As someone with no background in systems languages, I've never heard of in memory attacks based on the wrong hashing algorithm. So I got some questions:

How does the secure hashing algorithm prevent a DoS or any other attacks?

When should I opt for a more secure hash over a faster one?

Sometimes applications use untrusted data as the key in a hash map. A simple implementation can allow the untrusted data to cause a denial of service attack.

Hash maps are fast - O(1) - in the best case, but slow - O(n) - in the worst case. This is because keys are normally in separate buckets, but some values can result in the same hash - a collision - which are handled by a slower linked list. With random data, collisions will be uncommon. However, some implementation have a vulnerability where malicious data can cause many collisions, which makes the hash map slow. Some years ago there was a Linux kernel DoS due to this.

The root cause of the Linux vulnerability was that hashing was predictable. It was fixed by introducing a key into the hash function that a remote user would not know. I don't know exactly how Rust hash maps work, but I expect they use a similar kind of keyed hash.

You should opt for a more secure hash any time you're using untrusted data as a key.


I have a public network. How can I prevent the users from visiting bad websites? I have a friend who owns a coffee shop and he has a public network.
He asked me for a way to prevent the customers from visiting any web site that present a potential threat to the admin (websites that has either sexual content or any kind of extremism). How can I block such sites?

What you need is a web filter. This creates the ability to inspect the traffic and filter it depending on the destination.

Note that, unlike the other answer, this does not need any SSL interception since all you are doing is reviewing the IP names and addresses.

Typically, you will use a product that uses dynamically updated block lists, generally grouped so that you can disable access to whole categories such as gambling very easily.

There are many products that will do this at different price points. One example is Sophos UTM though that is most likely overkill for your needs as it is an enterprise tool. Trend and most of the other recognised security vendors all have web filtering tools available.

If you want something quick and dirty, you can also switch your DNS service to use OpenDNS. OpenDNS also provides dynamically updated web filter lists but they work simply by preventing an IP Address lookup so it is possible to bypass the restrictions - generally by users manually setting their own DNS servers.


Protect Wordpress against ddos attack The  above screenshot is from my website's cpanel visitors list.My website is build on wordpress. And I think someone is trying hard to crack open my website with DDOS attack and drain out my 10gb bandwidth in single night.Although I've applied https and blacklisted the repetitive ip address  accessing the non existing URL. What are the other possible methods to avoid this kind of attack ?

There's a lot of possible ways to enhance the security of your site. But it depends on the architecture of your website, if it is a dedicated server or not.

Use anti-DDOS services- If you want free you can use Cloudflare. It will help you to block attacker requests, like botnet. Here's the link https://www.cloudflare.com/
Use Wordpress plugins to enhanced security - I used Wordfence, which includes an endpoint firewall and malware scanner that was built from the ground up to protect WordPress.
https://www.wordfence.com/
Increase Internet Bandwidth and Server Capacity - The main reason your website can crash or go offline after a DDoS attack is if it doesn’t have the capacity to handle the volume of traffic sent by the attacker.


Why doesn't openssl s_client correctly validate google.com:443? I try

$ openssl s_client -connect www.google.com:443

but it openssl complains that the cert chain is invalid:

$ openssl s_client -connect www.google.com:443
CONNECTED(00000003)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0

Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority

Why is this happening?  The Equifax root cert is in my /etc/ssl/certs directory, and if I download the chain and use verify, openssl will verify the chain.

$ uname -a
Linux moxie 3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:02 UTC 2015 i686 i686 i686 GNU/Linux
$ openssl version
OpenSSL 1.0.1f 6 Jan 2014
$ openssl version -d
OPENSSLDIR: "/usr/lib/ssl"

On OpenSSL 1.0.1f

$ openssl version
OpenSSL 1.0.1f 6 Jan 2014

$ openssl s_client -connect www.google.com:443
CONNECTED(00000003)
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---

On OpenSSL 1.0.2e

$ openssl version
OpenSSL 1.0.2e 3 Dec 2015

$ openssl s_client -connect www.google.com:443
CONNECTED(00000003)
depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority
verify return:1
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA
verify return:1
depth=1 C = US, O = Google Inc, CN = Google Internet Authority G2
verify return:1
depth=0 C = US, ST = California, L = Mountain View, O = Google Inc, CN = www.google.com
verify return:1
---
Certificate chain
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---

So looks like there is a change in behaviour from the version which you have. You could either specify the CApath explicitly or upgrade to a newer version.


Why is there a list of known WiFi networks in my airodrop-ng output? As you can see that in the second list -visible devices, if I am not mistaken- the top device is my main laptop, this output is from a different laptop that is, of course, not connected to any networks (otherwise airmon-ng wouldn't start).

How/where does it get this list of networks the computer has connected to? And is this a problem security wise?

This is called "Probe Request" and it is a special frame sent by a client station requesting information from either a specific access point, specified by SSID, or all access points in the area, specified with the broadcast SSID.

You can read more information about this here.

  How/where does it get this list of networks the computer has connected
  to?

It's a list with all known networks your device has successfully connected and marked as "Auto-Connect" by your system.

  is this a problem security wise?

Yes, because an attacker could reply to the probe request with a fake AP, created only to sniff your data. It's possible to perform this with a lot of tools, even with your own OS, creating a hotspot with the same name as the network your computer is probing.

I recommend you reading this and taking a look at WifiPhiser.

And no, you cannot disable this, because it's essential to inter-AP roaming.


Can the MAC address be "hidden"? ie that the information is not even delivered Along with the above question, I would also like to know how can the MAC address be properly changed? Moreover, can it be replaced by a casual sequence or there are specific addresses to use? Finally, once changed, can it be reset to the default value?

Changing an interface's mac address is not terribly difficult at all.

You can also change the MAC address through various other methods, such as a VPN, or on VirtualBox. Not all of these methods will allow you to change your router's MAC address. You should have a MAC for each interface on your network. Many newer routers have more than one interface (wired, wireless, and router, for example).

But is changing your MAC address the answer?

As for hiding your router's MAC address, be warned: many ISPs require your device's MAC address before they even allow you to connect to the internet. And even if you spoof it before providing the spoofed address, that is the address they expect you to be connecting from.

There are legitimate uses, such as spoofing a new router's mac address so you don't need to bother with calling customer service in order to get online.

If I'm understanding you correctly, you want to mask your presence.

If you wanted to "hide," you'd need to change every single interface's MAC address. And even then, you can't really hide this way: the router is still tied to your name.  If you intend to "hide" using a mobile device, that is far more feasible. Just google "change mac address devicename". However, there are many other things you need to do to properly mask your presence. This is beyond the scope of my answer.

Can you change your MAC address to anything you want?

  Moreover, can it be replaced by a casual sequence or there are specific addresses to use?

No. It has to be an appropriate mask and length. Usually, you need 12 Hexadecimal digits, and the 2nd character can't be odd if it's unicast. For example, if unicast, the 2nd "digit" can't be any of the following:

Digits: 1, 3, 5, 7, 9
Letters: B, D, F

  Finally, once changed, can it be reset to the default value?

If you're able to change it, then you should be able to change it again. Just set it back to what it was before.


output from CryptGenRandom Can we capture the output of Windows CryptGenRandom function.
Suppose an application is utilizing CryptGenRandom, as a user can we know what is the Random Number generated and given to the application

If you have control over the environment in which the application runs — basically, if you have access to the account under which the application runs — then you can observe everything it does. Simply run the application under a debugger and put a breakpoint or a trace on calls to CryptGenRandom.

If you don't have control over the execution of the program, then you can't capture the output of this or any other function. The alternative would be to predict the output. You can't predict the output of CryptGenRandom, because it's a crypto-quality random number generator and it isn't implemented so badly as to be completely broken. The whole point of crypto-quality randomness is that it's unpredictable. The only way to predict the value would be to have access to all the sources of entropy of the machine and to know all the times when CryptGenRandom is called so that you can recreate the state of the RNG. In practice, if you can do that, you can run a debugger.


How does the 'QuantumInsert' attack work? I recently stumbled on descriptions of the 'QuantumInsert' attack (mainly used by the TAO group from NSA). This technique seems to be massively used to perform man-in-the-middle or man-on-the-side attacks to insert viruses on specifically targeted computer systems.

Bruce Schneier has several notes on it (see here and there and probably more...). It is also cited in articles published by Spiegel (in English) (see here).

If I understand well, this technique may be used to insert small payloads that are inserted in an HTML page that is currently loaded from a legitimate website. One could probably insert small JavaScript application made to penetrate the web browser of the target (if I understood well).

Now, I would like to know more about the limits of this technique. I read it that only NSA could get access to this kind of attacks, but could other governments, or big companies master this technique too ?

And, finally, I would like to know if there are some ways to protect your web access from this attack (at an individual level) ?

Edit: Just a good explanation from the 30C3 (Dec 2013) in this talk.

Well the most effective defense would likely be operating under non-standard conditions to complicate the use of known attacks.  For example, if you VMed your browser, then a compromise wouldn't matter unless they could also break out of the VM, but when dealing with an attacker that is directly targeting you and has massive resources, it's probably not safe to assume that they don't have a way to break out of the VM as well, but if you can externally limit what can connect in to your system (through an external firewall) and you can make sure that only the sites you want to go with are allowed to be visited, this would theoretically provide decent protection.

Alternately, if you only loaded HTTPS content, it would prevent insertion of third party content as long as you verify the certificate (and the site you are interacting with has not allowed their private key to be compromised).  Otherwise, it is reasonable to assume that any party capable of controlling a large number of routing nodes on the Internet could potentially modify your traffic if they so desired and inject a man in the middle attack.

Really it comes down to general best practices for untrusted browsing and using typical man in the middle protections.  It isn't really a new threat, just confirmation of a threat we've all known was a possibility for a long time.


How to define different firewall rules for different users on the same machine running on Windows 7? Provided that one machine running on Windows 7, connected to LAN, and connected to the Internet via a gateway in the LAN. There are two logon user accounts A and B on the machine. I want:

1, User A can access the LAN but except the Internet;

2, User B can access the Internet but except the LAN.

How to define different firewall rules for A and B to achieve this?

Thanks in advance!

If you are using the stock windows firewall, then this cannot be done. The firewall is machine-based, not user-based.

To have the control you want, you need to install a different firewall.


What are the implication of having Apache Tomcat servlets available publicly? While testing a website which had Apache Tomcat running, I came across a directory called "Examples" which contained "Servlet Examples", "JSP Examples" and "Websocket Examples".
What do you think are the implications of having this directory available publicly and how harmful can it be?

This has been documented in the past, where researchers discovered that some of the Tomcat examples left on a default install were vulnerable to exploits. In "vulnerability assessment/auditing" tools/programs, many will flag this directory as being at a high risk due to these applications being left on a system after an installation. A best practice approach to hardening systems is to remove defaults. (Default directories that are not needed, default passwords, change usernames, and so forth.) It is simply an open vector for an attacker to determine more information that can be further used to propagate attacks.


Why are stored procedures and prepared statements the preferred modern methods for preventing SQL Injection over mysql real escape string() function Why are stored procedures and prepared statements the preferred modern methods for preventing SQL Injection over mysql_real_escape_string() function?

The problem of SQL injection is essentially the mixing of logic and data, where what should be data is treated as logic. Prepared statements and parameterized queries actually solve this issue at the source by completely separating logic from data, so injection becomes nearly impossible. The string escape function doesn't actually solve the problem, but it tries to prevent harm by escaping certain characters. With a string escape function, no matter how good it is, there's always the worry of a possible edge case that could allow for an unescaped character to make it through.

Another important point, as mentioned in @Sebastian's comment, is that it is much easier to be consistent when writing an application using prepared statements. Using prepared statements is architecturally different from the plain old way; instead of string concatenation, you build statements by binding parameters (e.g. PDOStatement::bindParam for PHP), followed by a separate execution statement (PDOStatement::execute). But with mysql_real_escape_string(), in addition to performing your query, you need to remember to call that function first. If your application has 1000 endpoints that perform SQL queries but you forget to call mysql_real_escape_string() on even one of them, or do so improperly, your entire database could be left wide open.


What does "connection" mean in context of request smuggling I recently read about request smuggling. This is a very interesting attack that I didn't know about. A vulnerability to this was recently discovered at Slack, disclosed responsibly and a bounty was awarded.

The linked article says:

  When the front-end server forwards HTTP requests to a back-end server,
  it typically sends several requests over the same back-end network.

Request smuggling uses the fact that multiple requests go over one connection.

My question is: What is this connection? I'm a newbie at networking. I know that there are multiple layers to a connection: IP, TCP, SSL. Can you please explain what is the layer at which this connection exists?

Update: If someone could include an example, preferably in Python, of how one would send multiple requests on the same connection, that'd be helpful.

This is about a TCP connection (both with and without TLS). With HTTP keep-alive multiple HTTP requests can be send one after each other inside the same TCP connection and it is up to the HTTP stack to properly distinguish where a request starts and where it ends.

Due to the complexity and in some cases ambiguity of the HTTP standard it is possible to create sequences of HTTP requests where different HTTP stacks (i.e. in front-end and back-end servers) have different ideas where a request starts end ends. These interpretation differences allow HTTP request smuggling.


Books on Cryptography, with a focus on application to Network Security? Looking for some nice text books in the field of network security as part of my course. Our course covers mainly tls, ssl, pgp, smime, vpn, md5, hmac ....

Check out Practical Cryptography:
http://www.amazon.com/Practical-Cryptography-Niels-Ferguson/dp/0471223573/ref=sr_1_1?s=books&ie=UTF8&qid=1304454787&sr=1-1

  Written by Niels Ferguson, lead cryptographer for Counterpane, Bruce Schneier's security company, and Bruce Schneier himself, this is the much anticipated follow-up book to Schneier's seminal encyclopedic reference, Applied Cryptography, Second Edition (0-471-11709-9), which has sold more than 150,000 copies.


Should access control be managed from inside application? I am a developer who's just starting to learn about authorization and authentication for web apps. I am bit unclear on the concept of managing access control to parts of the app, and where is the best place to have access control managed, given the plethora of third-party authorization services like AD or Auth0.
For instance, let's say I have an eCommerce website, and I use Azure's Active Directory (AD) to manage my users login. Several parts of the website include, say, items management, category management, and promotion management. Some roles could be, "item manager" - who's able to see and modify items, a "marketing executive", who will be able to see and modify promotions, and a superadmin, who can do anything.
Is it a good practice to have the role and access management available directly inside the app? So if a superadmin would like to create a new role, who has both access to item and promotion management, they can create the role inside the app and assign it to users. The back-end then would directly go to AD and create a new role. Is this even possible?
Alternatively, should all these roles be managed directly inside AD? If so, what would happen as the application grows and have extensions of functionalities - would developers then need to add new claims to the existing roles every time they develop something?

As always: it depends. It depends, for example, on your relation with the users. Are they from your company or are they clients?
If the users are not from your own company, you will want to separate your application users from your internal access. That means that, if you want to use an AD for authentication/authorization, you will create a separate AD. Depending a bit on your design, you may also use LDAP or even database tables.
Also, if your users are external and part of a large company, you could use their AD (SAML tokens etc.) In that way, you do not need to do user management (think password resets). Especially larger enterprises will appreciate not having to do a separate user administration for your application.
It depends also on your organization, what you are comfortable with. Personally, I would never use an AD, not just because of the unneeded complexity that it introduces, but also because I have more experience with a simple LDAP. However, if you're in a more Microsoft-knowledgeable organization, you may be comfortable with AD. You will however probably need multiple ADs.
It also depends on who does the access management. If your user-base does their own user management, than a form of authorization management must be offered to them.
So there is no clear yes/no answer.
Some points though:

do not mix your own users (operators, developers) and clients on the same authorization/authentication system
if you have a corporate client, offer a way to integrate in their authentication mechanism
if your user base does their own authorization/access management, they  must have a way to do this (probably in the application), even if they cannot offer their own authentication tokens.