Building a web application security focused team I work as an application architect at larger company that builds web applications using both .Net and Java technologies.  These are sold to and accessed by other businesses (not consumers).  We have multiple application development teams working on these, including various skill levels of employees, contractors/consultants and outsourced teams.

We have a mature Information Security group, data center operations, networking. etc.  We also have mandatory application security training, scans of source code with third party software and guidance via security policies and procedures.

i’m trying to advocate for a smaller team (3-4 people) that could focus on detailed, code level implementation and remediation items from audits and scans.  These individuals would understand how the OWASP Top 10 looks like in code and over the network, and not viewed as a management checklist.

Question:  I’m looking for information about the right skill mix in building this team, preferring any documented case study, but opinions also hold value.  I want to avoid a generic list like: Java developer, .Net developer, tester, DBA, etc.

Also, trying not to make this a subjective, open ended question - so would appreciate any recommended edits.

Cigital's Building Security In Maturity Model (BSIMM) is a detailed study of software security initiatives in 67 organizations. All BSIMM participants have an internal group devoted to software security called the Software Security Group (SSG). The BSIMM FAQ describes the role of characteristics of the software security group (SSG) at http://bsimm.com/facts/.

According to the BSIMM FAQ the "SSG size on average is 14.78 people (smallest 1, largest 100, median 7) with a "satellite" of others (developers, architects and people in the organization directly engaged in and promoting software security) of 29.6 people (smallest 0, largest 400, median 4). The average number of developers among our targets was 4,190 people (smallest 11, largest 30,000, median 1,600), yielding an average percentage of SSG to development of just over 1.4%."

Gary McGraw, Sammy Migues, and Jacob West discuss the rationale and benefits of the SSG, particularly in the context of an comprehensive software security program covering the software development life cycle. They found the "percentage of SSG to development of 1.4% in the sixty-seven organizations we studied. That means one SSG member for every 71 developers. The largest SSG was 27.27% and the smallest was 0.03%."

  Though none of the sixty-seven SSGs we examined had exactly the same
  structure (suggesting that there is no one set way to structure an
  SSG), there are some commonalities we observed that are worth
  mentioning. At the highest level of organization, SSGs come in three
  major flavors: those organized according to technical SDLC duties,
  those organized by operational duties, and those organized according
  to internal business units. Some SSGs are highly distributed across a
  firm, and others are very centralized and policy-oriented. If we look
  across all of the SSGs in our study, there are several common
  "subgroups" that are often observed. They are: people dedicated to
  policy/strategy and metrics; internal 'services' groups that (often
  separately) cover tools, pen testing, and middleware
  development/shepherding; incidence response groups; groups responsible
  for training development and delivery; externally-facing
  marketing/communications groups; and, vendor-control groups.

For more about this issue see Gary McGraw's informIT article 'You Really Need an SSG' at  http://www.informit.com/articles/article.aspx?p=1434903


Is it worth notifying companies about reflected XSS that gets filtered by the XSS auditor? I am wondering if I should report a reflected XSS vulnerability if it gets filtered by the XSS auditor of browsers.

For example, if I find an XSS vulnerability in www.website.tld/some-action/?productSku=tes"%20onload="alert(1), but the browser shows me the following auditor error:

In my case the targeted website does not have the X-XSS-Protection header set, but most of the browsers enable XSS protection by default. I know I can try other things, like loading a malicious GIF file with JavaScript, but i'm just wondering if the onload=alert(1) above (which gets filtered) would also be considered a security issue, and why it would or wouldn't.

New bypasses for the xss auditor are found on a regular basis, and there are browsers like FireFox, which still lack a built-in XSS auditor. Reflective XSS needs to be fixed because it is a weakness in the operation of the application.  Relying upon a 3rd party security system is... shaky at best.

When XSS is common place,  other vulnerabilities follow.


MitM Attacks - Iptables? I have looked for the answer to this question to no avail, apologies if I missed it.

I would like to know how effective iptables would be against MitM attacks - in the following setup:

ALLOW INPUT {only one IP address}
DROP All Else Anywhere

I guess what I am asking is, would it still be possible for someone to masquerade as the one allowed IP to connect and prepare mitm attack on any incoming connections?

Also, what if the connecting device had the same iptables configuration, allowing only the first device's IP...

You'd think that would be a fairly secure setup - but I want to be sure...

Yes it will be possible to successfully achieve a MITM attack.

Consider the simple scenario where the origin IP you are allowing has a LAN inside so any person in the LAN will be able to MITM any connection since all of them has the very same "outside" IP.

SERVER <-- IPTABLES (only IP1 filter) <--------- LAN(IP1) (natting) <-|--- MITM Client
                                                                      |
                                                                      |--- Client 1

Here Client 1 may init a connection, and MITM client can intercept it transparently. (you have the very same problem in the other way).

The best way you have to solve this is using point to point connection with authentication (using certificates or similar).


Is starting an AWS instance with only ssh to port 22 significantly insecure? Unless someone has my private ssh key, how is leaving an aws instance open to 0.0.0.0 but only on port 22 via ssh insecure?

The ssh key would be distributed to a small set of people. I prefer to not need to indicate their source IP addresses in advance.
I do see another similar question  SSH brute force entry in aws ec2 instance .

If you disabled password based login via SSH, then it is very hard to brute force an SSH login using a private key (

Maybe this covers it? Just want to double check since in the security world you do not get a second chance.

The answer depends on your risk appetite. Restricting access to the SSH port to only known IP addresses reduces the attack surface significantly. Whatever issue might arise (private key leaks, 0-day in SSH, etc.), it can only be exploited by an attacker coming from those specific IP addresses. Otherwise the attacker can access the port from anywhere, which is especially bad in case of an unpatched SSH vulnerability with an exploit available in the wild.
It is up to you to decide, how important the system and its data is to you. If it is not that critical, the convenience of an SSH port open to the world might be appropriate. Otherwise, I would recommend limiting access, just in case. Severe 0-days in SSH do not pop up on a daily basis, but you never know when the next one will.


SSL/TLS Client Authentication by IP Is there any mechanism in SSL/TLS which allows a certificate to be bound to a device?  Example:

There is a client who talks to a server, and during SSL/TLS setup, there is mutual authentication.  The server verifies that the client presented a certificate which is valid (Expiration date, CRL/OCSP, etc.) and has whatever required fields the server wants to see (x.example.com domain, signer of XYZ Corp, etc.).

However we would also like the server to relate certain characteristics of the client certificate (thumbprint, serial, etc.) to the client itself (IP, Hostname, NetBT, etc.).  Is there any built-in or third-party mechanism that does this, or am I missing something?

The concern is that a certificate will be exported from a client by someone with elevated privileges (We will have strict ACLs but we are assuming these are ineffective at stopping the attacker), and then installed on a second device.  I understand that, if someone had elevated privileges on a machine they could just do whatever badness they wanted to do on that box using the existing environment, but if they are able to use the certificate on a second device, they could bypass security controls (local firewalls, av, etc.) and security audits (firewall is enabled, av is on, actions are logged and sent to syslog server, etc.).

From the point of view of the server, all that can be seen is the client certificate (a public object, which is basically a bunch of bytes that everybody knows) and also a signature from the client (the signature is computed during the SSL handshake). The signature, being verified, offers some guarantee to the server that whoever is talking to it also knows the private key (which corresponds to the public key in the certificate).

The private key is everything. In cryptography in general, you are what you know. "The client device" is then defined as "whatever systems who can compute signatures verifiable with the device's public key". If an evil admin can slurp all the private information from a device, then he will be able to get the private key and impersonate the device with, say, another hardware element or even a PC. There is nothing you can do about that server-side: from the server, there are only zeros and ones over wires to be seen. The server cannot know that any piece of hardware even exists.

In order to achieve the kind of resistance you are after, then you need some tamper-resistance: make it impossible, or at least very hard, to extract all of the private information from a client device. That's typical smart card area. Now you see why mobile phones have a SIM card...


OWASP CSRFGuard obtains the token via XMLHttpRequest - why? I want to use the CSRFGuard Project to protect a legacy Java webapp against CSRF attacks. The latest published Maven dependency version is 3.1.0, which is what I use.

This is part of the JavaScript code that is included on every protected page:

var xhr = window.XMLHttpRequest ? new window.XMLHttpRequest : new window.ActiveXObject("Microsoft.XMLHTTP");
var csrfToken = {};
xhr.open("POST", "/JavaScriptServlet/", false);
xhr.setRequestHeader("FETCH-CSRF-TOKEN", "1");
xhr.send(null);

var token_pair = xhr.responseText;
token_pair = token_pair.split(":");
var token_name = token_pair[0];
var token_value = token_pair[1];

It is a separate JS file generated by a dedicated servlet, with no-cache headers.

I do not understand why the token name and value are not directly embedded into the generated JavaScript, but instead fetched via a synchronous (!) AJAX call.

Are there any vulnerabilities if I change it to include the token directly?

Are there any vulnerabilities if I change it to include the token directly?

Oh yeah.

Then an attacker could just include that script on their page:

<script src="http://yourserver.tld/yourpart"></script>

And let it run this code:

var token_name = "sample-token-name";
var token_value = "sample-token-value";

Then both token_name and token_value will not be global variables on the attacker's page that can be accessed and used to create the CSRF attack.

The reason they are using AJAX to get the token is that this request would fail if the attacker just includes the script tag because of same-origin policy.

As for why they are using synchronous AJAX, I doubt there is a reason except poor design.


Snort priority range What is the range of values for the 'priority' parameter in a Snort rule? The documentation it doesn't make it clear:

  The priority tag assigns a severity level to rules. A classtype rule assigns a default priority (defined by the config classification option) that may be overridden with a priority rule. Examples of each case are given below.

  Format

  priority:<priority integer>;

  Examples

  alert tcp any any -> any 80 (msg:"WEB-MISC phf attempt"; flags:A+; \
  content:"/cgi-bin/phf"; priority:10;)

  alert tcp any any -> any 80 (msg:"EXPLOIT ntpdx overflow"; \
  dsize:>128; classtype:attempted-admin; priority:10 );

The short answer:

Whatever your heart desires.
Just tested up to priority:1000000; and works just fine.

What it says in the manual:

The following was put under §3.4.6 - classtype, the section immediately preceding priority:

  Attack classifications defined by Snort reside in the classification.config file. The file uses the following syntax:

  config classification: <class name>,<class description>,<default priority>

  These attack classifications are listed in Table 3.2. They are currently ordered with 4 default priorities. A priority of 1
  (high) is the most severe and 4 (very low) is the least severe.

Hope this answers your question!


AIDE and OSSEC conflicts? Being fairly new to both AIDE and OSSEC I've been trying to find out if there are any potential conflicts in having them both installed on one host (CentOS 7.5). It seems like they could work as a multi-layered approach, but I haven't been able to find much about running the in tandem. And of course would there be a difference in running them OSSEC locally vs. an agent on the machine with AIDE? Thanks.

I have used AIDE in past and it does only file integrity monitoring. It creates a database when you first install the same, probably mapping hashes along with the respective file names. This comes handy when you want to see any Malware/Program changes which files.

Said that, OSSEC is more superset. Read "AIDE only does file integrity checks. It does not check for rootkits or parse logfiles for suspicious activity, like some other HIDS (such as OSSEC) do." from this site

I don't see any issue with both of them running on same system, but I don't see value in having both unless you find anything which proves OSSEC prone to hash-collision.

To answer the second part of your question, decision of deploying the OSSEC in Manager/Agent mode or standalone mode depends on the requirement. If there are hundreds of hosts, you want centralized management where all the database is stored on server side.


Is it possible to add an x509 extension to a certificate after creation? I'm under the impression that x509 extensions must be added at certificate creation time. Just want to check that my understanding is correct and that I can not take a certificate after it was created and add the extension then.

These are extensions my test opc-ua server might require:

    X509v3 Key Usage:
        Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Certificate Sign
    X509v3 Extended Key Usage:
        TLS Web Server Authentication, TLS Web Client Authentication

You are correct that you cannot add an extension to an existing certificate.

Adding an extension would change the contents of the tbsCertificate portion of the certificate, and that would invalidate the signature on the cert.

Producing another certificate which is in all other respects the same (but has this extension) is theoretically possible if you own the CA.  If not, you'd just be submitting a new request, and that would mean you get a new serial number.  (Either way you'd get a new Thumbprint/Fingerprint, since that's a hash of the certificate, and not an intrinsic value).


How to decrypt Diffie-Hellman encryption in WebRTC? I have installed a WebRTC server application, which is designed for Contact Center solutions: communicates with internal PCs in pure RTP (agents), and with external PCs (customers) using encrypted WebRTC. WebRTC is encrypted with Diffie-Hellmann. I would like to be able to decrypt the WebRTC RTP stream, and eventually replay it, to be able to debug quality related problems (sometimes quality is OK between agent and server, but very low on customer device, and not sure whether to blame the network, the server or the customer device). In such a debugging scenario, I will have full access to the server (root access in linux, able to tcpdump and do basically anything), and most of the time I will have full access to the customer device (e.g. Administrator access on my laptop).

What I have done so far is I added SSLKEYLOGFILE environment variable, and Chrome started printing a lot of data in it, like this:

CLIENT_HANDSHAKE_TRAFFIC_SECRET 5fc29d95842ec41a2faa367ad799e25ec020eb2bba47a2ae4b25dd45b26715fe f3eb56ec637c241f6a7bffed601b362bb39035c9a204d6259bf221d7428cef50

CLIENT_TRAFFIC_SECRET_0 5fc29d95842ec41a2faa367ad799e25ec020eb2bba47a2ae4b25dd45b26715fe e848e23888913118a3a717c137f0299d4bdea98a7c0513eca728dca63ab07f77

SERVER_TRAFFIC_SECRET_0 5fc29d95842ec41a2faa367ad799e25ec020eb2bba47a2ae4b25dd45b26715fe f22862cd1d888f083ce7c55207c2d044db8dab24be5d5304b53f3b08588436a4

EXPORTER_SECRET 5fc29d95842ec41a2faa367ad799e25ec020eb2bba47a2ae4b25dd45b26715fe 015444c5a2ef5c7a691a10ca168fc0c8e4e0d00127d3c2f1cdda27ec671b3c94

CLIENT_RANDOM 9265831d9c50fc1a45d1ba06bfda5c10bea1c82104ec0170add0187ad1cb76b5 736c310b97a1c1e887d57f222d3e74ee022d91ad9fdcaa9006e2a21eeb4fd863c5fa76b9a61aabda44906b84501c960a

My problem is, that based on online articles, I should be able to find the 'Random Bytes' as seen in Wireshark in this file, however I cannot. I tried session id, random bytes, basically all similar looking strings that I saw in Wireshark, but I can't seem to find them in the SSLKEYLOGFILE. Nevertheless I added SSLKEYLOGFILE into Wireshark to DTLS protocol as (Pre-)Master-Secret file, but the traffic is not decrypted. The Wireshark SSL debug file doesn't print anything that resembles an error (although I'm not sure what to look for). I can see various messages:

dissect_ssl enter frame #22 (first time)
packet_from_server: is from server - FALSE
  conversation = 0000027E892C55E0, ssl_session = 0000027E892C5C80
  record: offset = 0, reported_length_remaining = 581
ssl_try_set_version found version 0x0303 -> state 0x10
dissect_ssl3_record: content_type 23 Application Data
decrypt_ssl3_record: app_data len 576, ssl state 0x10
packet_from_server: is from server - FALSE
decrypt_ssl3_record: using client decoder
decrypt_ssl3_record: no decoder available

ssl_decrypt_record found padding 8 final len 327
checking mac (len 307, version 303, ct 23 seq 1)
tls_check_mac mac type:SHA1 md 2
Mac[20]:
| c9 62 43 71 5c 9f 91 31 0d 98 cc 3b 9a 37 2f 1a |.bCq\..1...;.7/.|
| 0b 61 3d dd                                     |.a=.            |
ssl_decrypt_record: mac failed

  checking keylog line: CLIENT_HANDSHAKE_TRAFFIC_SECRET 1c88cbccba12f83b5752f3dc49cd4294dbb77f0a6992f728d129af34e4d70350 39741b6d2d8cecaa23477ecd1929d7f21560397fe48aec4c11ec92d263cfa542
    matched client_handshake

tls13_load_secret TLS version 0x303 is not 1.3

So basically I'm stuck at this point. What am I missing? Do I need to export something from server side also? Or more Wireshark configuration?

EDIT:

You can check SSLKEYLOGFILE, Wireshark debug log, and raw capture here: https://drive.google.com/open?id=1-1XnRVvrTqQiHq8bF3KTLKZzKAC9zRb0

In the capture, 10.35.119.32 is the server IP which handles RTP, 16004 is the WebRTC port (there is unencrypted RTP also from/to this server, which is the agent RTP as I mentioned, on port 17xxx).

Providing my comment as an answer since my reputation is to low for commenting.
When using a SSL key log file it maps "identifiers" to master secrets.
It tries to map by the following identifiers:

Session ID ( that is the Session ID filed if a Server Hello handshake message)
ClientRandom ( 32 bytes within the Random filed of a Client Hello handshake message)

Debug log:
ssl_finalize_decryption state = 0x17
ssl_restore_master_key can't find master secret by Session ID
ssl_restore_master_key can't find master secret by Client Random
  Cannot find master secret
packet_from_server: is from server - TRUE
ssl_change_cipher SERVER
packet_from_server: is from server - TRUE
dissect_dtls_record: content_type 22
decrypt_dtls_record: no session key

So you're right. It can't find the master key.
I would try my luck here Wireshark forum
What OS, Browser (Version are you using).


"Secure" drawing of lots I want to randomly choose a game in the 50 games I have, in order to play with one of my friend. But this friend doesn't trust me, and neither do I: every time one of us pick up a game, the other complains that the choice was not really random.

A first solution could be to put all the names in a hat and after pick up one name; but we're both paranoiac: the hat could contain only one name repeated 50 times, so we have to check that all the names are present only once to ensure an random choice. This is to long.

Second solution: we both randomly choose an integer  in [1,50], write it on a paper, and then sum the result modulo 50. This is a good solution when we face each other.

But what if we want to choose an online game, me playing at Paris and my friend playing at NY ? I've trued to emulate the above protocol: each player choose randomly a number in huge interval like [1,1e30] and in a first time send a hash of its number (simulating the fact of hide the number on a piece of paper). When each player have received the hash of the other, the two players publish their numbers and add them modulo 50.

Is this protocol correct? Is there a better (maybe faster) protocol for this purpose?

What you want is a variant of a coin-flipping scheme. The standard way to do this is, as you've identified, to have both people come up with a value and then combine those values such that neither side has any control over the outcome by themselves. You've decided to use modular addition; this is indeed a standard way. You've also identified the issue with that, which is that whoever decided second could control the outcome (as they know what the first person picked), so you need people to commit to their values before they know the other person's value.

This sort of thing is called a commitment scheme. In these systems, Alice has some value she wants to commit to. Specifically, she should send something to Bob which encodes her value, but from which Bob cannot recover the value. Alice can then send Bob a piece of information when it's time to reveal her secret; the idea is that she can only reveal the value she originally committed to.

To get more concrete, assume Alice wants to commit to one bit. She wants to produce a "blob" to send to Bob; this blob encodes either 1 or 0. Then, when it's time to reveal the bit, Alice and Bob can open this blob, using some additional information Alice provides. The two key properties of the blob are that Bob can't discover which bit it encodes, and they can only open the blob to one of the two bits (Alice can't produce a blob encoding 1 and then cheat by opening it to 0).

With bit commitment, you can use a collision-resistant hash, compute the blob as H(s||b) with long random s (you hash s concatenated with b), and reveal s to open it (well, s and b, but revealing s makes it easy to get b). This is equivalent to having a long number and taking it modulo 2 to get the committed bit. Your scheme has similar effect, and should work provided you can't find collisions.

Unfortunately, just doing that means that someone who does find a collision can use it repeatedly. It's better to have Bob provide some random bitstring b to Alice, and have Alice compute a second (secret) random bitstring a, have Alice encode a number from 0 to 50 as 6 bits n (fixed-length, so she can't claim the dividing line is somewhere different than what it actually is), and compute the blob as H(b||a||n). This means that even if Alice finds a collision in H, it doesn't help; she needs a colliding pair that starts with b.


Can data be uploaded to iCloud without your consent? I have been a loyal iPhone user for years. I did have two Apple IDs previously. The other one has already been deleted by Apple formally.

The current Apple ID I am using was set up years ago when you had the option of opting out from iCloud features. So basically the iCloud was never set up at the first place with regard to this ID. Under my ID profile in the setting, the iCloud status was off.

So can I confirm if my data of phone were all kept locally on my device without being uploading to any cloud own by Apple without my knowledge?

I am not using Safari for either but Firefox or Google Chrome. Even if you have an iCloud activated, would the data of these 3rd party apps also be transmitted to Apple Servers through iCloud?

theoretically you can't confirm. Apple can lie to you. But you got no reason to think they will.

The real answer is for data linked to your Apple ID you can confirm. By going to the Apple privacy portal. You can request to download every single bit of data they got on you. And see for yourself.

This includes:

  Apple Media Services information    Includes App Store, iTunes Store, Apple Books, Apple Music, Podcasts activity
  Apple ID account and device information
  Apple Online and Retail Stores activity  Show more Apple Online and Retail Stores activity
  Apple Pay activity
  AppleCare support history, repair requests, and more Show more    AppleCare support history, repair requests, and more
  Game Center activity
  iCloud Bookmarks and reading list
  iCloud Calendars and Reminders
  iCloud Contacts
  iCloud Notes
  Maps Report an Issue
  Marketing communications, downloads, and other activity
  iCloud Drive files and documents
  iCloud Mail
  iCloud Photos
  Other data

No need to download everything. Just what you want to view.


Kali Linux Hydra question Recently a friend of mine coded a website and he asked me to brute force it to test it
HTML code of the page trying to use hydra on
https://pastebin.com/D2iQXrNb (use Pastebin because I don't know how to put HTML code in here)

so I used this hydra syntax hydra -l '' -P /root/Downloads/a url.com http-post-form "/admin.php:pass=^PASS^:F=Invalid input!" -t16
the problem is im getting too much green lines (false positives)
so am i doing something wrong?

You seem to specify a form that specifies an input named pass.

However, the HTML you linked to specifies an input named Password.

Secondly, it is may be good to try a less strict failure condition :F=Invalid instead of :F=Invalid input!, as sometimes encoding issues can cause a match to be missed.

In short, try:
hydra -l '' -P /root/Downloads/a url.com http-post-form "/admin.php:pass=^PASS^:F=Invalid input!" -t16

Also, it is not clear from your question if you have too many "greens", or all "greens"?

In short, try:

hydra -l '' -P /root/Downloads/a url.com http-post-form "/admin.php:Password=^PASS^:F=Invalid" -t16

Alternatively, start logging the requests and responses to see what is going on.


Does an authorization code grant rely on sessions? It's my (possibly flawed) understanding that the authorisation code grant is attractive because it keeps access tokens away from a potentially insecure user agent.  I understand how this would work with the initial call:

The (insecure) user agent gets a code from the auth server
The agent then hands the code to the (secure) client application.
The client application can then exchange it for access/id/refresh tokens.

All good so far.  But now the user agent makes a 2nd request.  How does that request get linked with the token(s) from the initial call?

It could go back and get another auth code, but this seems
impractical.
It can't use the same code again as they're single use.
It doesn't have any of the tokens itself (as they're nice and safe on
our app server).
So that leaves me with sessions.  I.e. The app
server matches the HTTP session with the tokens.

Can someone confirm or correct this assumption?  While the initial call is well documented, I can't find much in the way of what happens on subsequent calls.  Any links to the actual mechanism would be appreciated!

Edit (to add context)

I am interested in securing a single page application calling an API.  In the past I used an implicit grant for such interactions (with the access token being sent from the browser on every API call).  However, given that the implicit grant is no longer consider to be secure I would like to switch to an authorization code grant.

So my question is:  After the initial authentication, what goes out on each subsequent API call for authentication?

A token?
A session cookie?
Something else?

After the initial authentication, what goes out on each subsequent API call for authentication?

For API's:

Each successive API call would use a token (Access token). You would be using https://oauth.net/2/grant-types/client-credentials/ (API/Resource focus)
Access is constrained by scope and linked to the Access Token. This prevents calls to unapproved API's for a given token (https://oauth.net/2/scope/)

For webapps:

You would likely use https://oauth.net/2/grant-types/authorization-code/
You are correct when you say you would set up a session using something like a cookie to identify the user.

On a previous project we used Auth0 (I am not in any way affiliated). They have some sample apps - https://auth0.com/docs/quickstarts . I use Java primarily, so I have linked those as well. It is also free to sign up and play around:

API > https://auth0.com/docs/quickstart/backend/java-spring-security
Webapp > https://auth0.com/docs/quickstart/webapp/java-spring-security-mvc
SPA > https://auth0.com/docs/quickstart/spa/vanillajs

Hope this helps?


empty angular application has some ad links in the source code I've started to learn angular and I've just followed some tutorials. I've created my application using the command:

ng new my-first-app

and then I've started it using:

ng serve

After my application started, I've looked in the source code and I've saw this:

I've scanned my system with a commercial antivirus, but didn't found any threat.

Should I be worried?

You have an ad-blocking browser extension which is injecting this CSS stylesheet into pages you view. (To be clear, this stylesheet is used to block ads, not to display them.)

This is harmless, and only affects you -- it won't affect others users viewing your site. If it's still bothering you, though, you can disable the extension for this site, or switch to an ad blocker which doesn't use this method. For example, one good option is uBlock Origin.


How to give rights to a System Administrator in an application? I am designing a security model for a web application which restricts access to certain parts of the app depending on what rights and permissions the user has. These rights and permissions are grouped together into Roles that each user can be assigned to.

However I need to create an System Administrator role that gives a special user full access to everything. In order to tackle this I can go about it in two ways:

Create a Role of System Administrator and give it every single
permission/right in the system (basically all the rights are stored
in a DB table). As the application evolves and becomes larger, the
Administrator role must also be updated so that it has access to the
new stuff.
Within the application itself, I allow for the System
    Administrator role to bypass security restrictions. So essentially
    it will check if the user has a certain permission, or if they're a
    System Administrator, it will let them through.

Option 1 presents some problems: it could be tedious and prone to oversight because each area of the application has Create, Read, Update, Write, and many more permissions. I have to include every possible combination of application area to permissions in a table for the role to have full access.

Option 2 present its own problems: the System Administrator bypass is hard-coded into every single area where a restriction is needed. If the name of the System Administrator role was to change (e.g. Master User) then I'd have to update the code everywhere. However this option means I don't need to worry about constantly updating the Role table so that the System Administrator gets permission to access new stuff.

I'm building an enterprise class software so it has to be scalable whichever option I go with.

Yes I know this is highly subjective if just treated just as is. But I believe there must be some good-practice security design pattern where one way is recommended over the other. There are things I can't foresee right now which others may have encountered. I would even appreciate some links to thoughts on this and good way to go forward.

How about you factor out authorization to a single function that makes all security decisions. Calls would be something like isAccessAllowed(user, FOO_OPERATION, <misc data>). Then your admin check is a single conditional in the start of the isAccessAllowed function.

Implementing such a system also allows you to change security backends without having to rewrite your application. It also does a nice job of separating security code from application code.


Can network traffic between Docker containers be sniffed? On normal networks, it is a security risk to send plaintext data, since attackers can sniff or even manipulate all traffic. Encryption is required for secure communication. When using Docker containers, these can be connected together using virtual network interfaces. Do these suffer from the same security problems, or are Docker network connections secure against sniffing? Is it necessary to encrypt traffic over the Docker network?

Edit: I am interested in whether the traffic between two docker containers can be intercepted by a third docker container, when all are on the same bridge network on the same host.

Yes, you need to secure the traffic.

Reading docs.docker.com:

  "if you need Docker to be reachable through the network in a safe
  manner, you can enable TLS by specifying the tlsverify flag and
  pointing Docker’s tlscacert flag to a trusted CA certificate. In the
  daemon mode, it only allows connections from clients authenticated by
  a certificate signed by that CA. In the client mode, it only connects
  to servers with a certificate signed by that CA."

In the article Top 20 Docker Security Tips by Jeff Hale, the author writes

  "Docker provides private container networking, too. This prevents a
  container from gaining privileged access to the network interfaces of
  other containers on the same host. So a Docker environment comes
  somewhat isolated, but it might not be isolated enough for your use
  case."

The article brings more ideas for strenghtening Docker security, including:

limiting privileges
avoiding running as root
using trusted and signed images
using minimal images and resources
managing keys securely
updating libraries
considering Docker Enterprise

Source:

docs.docker.com/engine/security/https
docs.docker.com/engine/security/security


How effective is disabling Firefox's geo.enabled setting for increasing anonymity? When viewing the bottom of a Google Search page, you can see that Google shows more or less your precise location, determined by your IP. This is useful for Google Maps.

In about:config is a switch geo.enabled which should disable this feature.

Of course using a VPN, Tor, etc. is considered for anonymity, but might the switch be also good?

Does disabling this only affect Google Search pages, or also other websites?

geo.enabled is a Firefox configuration setting that controls location-aware browsing.  From that page:

  When you visit a location-aware website, Firefox will ask you if you want to share your location.

  If you consent, Firefox gathers information about nearby wireless access points and your computer’s IP address. Then Firefox sends this information to the default geolocation service provider, Google Location Services, to get an estimate of your location. That location estimate is then shared with the requesting website.

If you are concerned about anonymity, I highly recommend using the Tor Browser Bundle for your browsing.


What could happen if someone guessed a password to my FTP server? I've always wondered what could realistically (and maybe theoretically) happen if one of those "always trying to log in with common passwords" remote addresses guessed my password and gained admin access to my FTP server at home.

From what I understand, an FTP server only has access to whatever directories and files that are already shared, but it can't execute arbitrary code and you can't add more directories or files to gain access to the rest of the system (at least I couldn't find how it could be done). So the "bad guys" could only slightly expand their remote storage space or hope that I execute a virus that they put on my hard drives and only then could things get really bad.

What could a malicious person do if they gained full access to my remote FTP server?

There are a lot of attacks that can happen if someone gets access to your FTP server.

1) Wipe out your data stored on the FTP server.

2) Steal your data stored on the FTP server.

3) Exploit any of a variety of vulnerabilities to compromise your server.

4) Upload malicious content in hopes that you'll execute it.

5) Replace existing content with similar but malicious content (index.html becomes a webpage selling kiddie porn or something) that you or your other software will execute.

Typically, all software has bugs. Some of those bugs are publicly known of. An attacker can use known and unknown bugs to compromise your system, and it is far easier when they have login access, especially administrative access to a system.


How safe is redirecting to another site? Lets say I have a website at https://example.com/test. Whenever someone accesses this site, I want to just simply redirect them to https://example.com/Test.

Are there any possible vulnerabilities here? Or is this method safe since all I am doing is redirecting from one secured site to another?

/test and /Test are both hosted on example.com … so it's just a page redirect not a domain redirect … this is a non-issue.

People redirect like this all the time, for instance redirecting from HTTP to HTTPS is pretty much industry standard at this point.


Securing a Web URL when called by a client application We are developing a single page Angular2/NodeJS app which will have a web based form for our users to fill and submit.We do not have any Web based application for our users to login to (so no SSO), but our users logs into our partner Apps, which can be a web application or mobile device each having its own authentication mechanism. Our partner apps basically calls our api to get various contents and show that in their UI. Now one of our content will have the link to the new form app that we are developing.

We want to secure the call to the Form app in such a way that the request can only be triggered from our partner apps and from no place else. The partner apps cannot stop the user from copying the url but we want to make sure that the request came in from our partner apps.

What is the best way to achieve this with minimal to no coding for our partners as we have no control over their development or release cycles. Few of the options we are evaluating

Option 1 :

Check the http header, Referer. https://en.wikipedia.org/wiki/HTTP_referer. This may not be the right solution as
a) it can be easily spoofed  (https://stackoverflow.com/questions/14854117/php-allow-access-to-specific-referrer-url-page-only) and
b) The client can be a mobile app and decide to not send the header

Option 2 :

Another option would be our partners to pass a token as a hidden parameter. So assuming any non tech savvy user will not look into the page source to find what the token is. Ofcourse this may need some dev activity from our partners which we would like to avoid.

Are there any other elegant solution which we can try

You're trying to use your vendors as Single Sign On providers. That is absolutely possible... if they are willing to implement some federated identity protocol like OAuth, SAML, Kerberos, etc. This would involve substantial engineering work on their part, and probably substantial burecruatic work and legal liability since HIPAA is in play. (I don't know. I'm not your lawyer).

For the reasons you've listed, relying on the Referer header or a shared, unlimited-use, unaccountable secret is absolutely out of the question. Further, trusting a user simply because he was logged in at a trusted vendor is also out of the question. Your API needs to know who, specifically, is acting on it, and store/log that information. Your business may not care, but HIPAA does.

SSO/federated identity protocols are ways of generating, passing, and checking tokens like your Option 2 that are specific to the user, time window, etc. Don't invent your own. OAuth is probably the easiest to implement.

The simplest solution is to build user accounts into your NodeJS app. Users must be logged in (have session cookies) to get anywhere with the URL from your vendor. No federated identity problem.

Another fairly simple solution is to have your API and your vendors' backends communicate directly, with no end-user browser in the loop. HTTPS and a simple token in an HTTP header would be reasonable. Mutual TLS with client certificates is the gold standard. But this relies on the secrets staying in the backend. This would also mean any changes in the way you interact are code changes for your vendors.

The real solution is to implement an Identity Provider (farm it out to Microsoft Azure, AWS, or OneLogin, or hire consultants to do it inside your firewall) and integrate it with all your vendors and your API so that your users only have one account to deal with. Your existing vendors almost certainly don't want this role. SaaS folks might not want it because HIPAA, but probably one of them will be willing to execute a HIPAA Business Associate Agreement for the right price.


Why do some LUKS tutorials mention overwriting the partition with random data? On a lot of tutorials on luks encryption, people say to override the partition with random data, so that data is not recoverable after encryption. I don't understand that. Will the random data be appended to the free space? Otherwise data would be lost, wouldn't it?

I've an unencrypted root partition and swap partition, in order to encrypt with luks i need an unecrypted paritition where boot is mounted in order to load initrd and decrypt the rest of the system /

I'm using an Ubuntu Distro by the way

I only do a speculation here what I think might be possible:

If you leave your harddrive "blank" that means in a "factory blank"-way or in a "there were readable files on it before"-way, an attacker can see things like partition layout, usage patterns and things alike due comparison of encrypted and unencrpyted areas. In a very extreme way he might be able to guess on certain information that is written to a specific part of the drive (like a partition header) and maybe obtain the key off that.

This will get harder and harder after some usage after most parts of the drive are overwritten at least once.

edit: (source)

  If you are concerned with leaking the size your encrypted partitions relative to the physical disk volume you will need to randomize the disks.


How to minimize vulnerability to UI state interference attacks Yesterday, Ars Technica posted an article explaining that Android was found to be vulnerable to a UI interference attack.

This claim originates from a paper published by Alfred Chen et al. of the University of Michigan a few days ago, which states that other operating systems are likely vulnerable to this same attack.

  In fact, this design is not specific to Android: nearly all popular OSes such as Mac OS X, iOS, and Windows also adopt this shared-memory mechanism for their window managers. Thus, we believe that our attack on Android is likely to be generalizable to other platforms.

Chen et al. show that these attacks can be used to steal login information or other sensitive information from unsuspecting users with relatively high success rates.

  In our evaluation, we show that for 6 out of 7 popular Android apps, the UI state interference accuracies are 80-90% for the first candidate UI states, and over 93% for the top 3 candidates.

This sounds like it could pose an immediate and serious risk to the privacy of smartphone and PC users. What can be done to minimize vulnerability and protect oneself against a UI state interference attack?

The core of the attack is to monitor another application's memory usage, spot a pattern that means "this application just opened a password-request window", and pop up the attacker's clone of that window in front of the real window.

For windowed operating systems (Windows, MacOSX, desktop Linux), one solution is focus stealing protection: prevent a non-foreground application from placing a window in front of the foreground window.  Some Linux window managers (eg. KDE) have focus-stealing protection.  Windows and MacOSX only prevent accidental stealing; intentional focus stealing is not prevented.


Email & Domain ownership? Most hosting companies, such as mine (hostgator) give the following notice when providing a contact email:

  Email address that you can be contacted at. This should be an email address that is not on your account if you have one.

On my side, I have taken precautions to secure my email, such as SSL, POP on a encrypted computer, erase email both computer & server after reading it and so on. While it is not perfect , I feel more comfortable since I have more options to overlook the security process than a account such as gmail, hotmail or yahoo (even though I am still depending on a third party).

My main concern is having my hosting account associated with a "external" third party account such as gmail, hotmail, yahoo and others, which I am not the owner of such domains.

If a email account is compromise, most likely other accounts associated with that email become compromised, most of the time through "Forgot password" functionality including the hosting domain. Isn't this just creating another door to my domain?

Would creating a email account just for my hosting account be the best option?
Or should I give my domain account for "xyzdomain.com" such as "user@xyzdomain.com"?

It is a double edge sword, I am able to overlook my own security but a malicious user could do the following:
A user with bad intention could find a way to get my account suspended, then I would be unable to contact with my hosting company (unless I call, and start going through a painful verification).

What are some advice or plans I could take?

Hushmail is pretty well-known for its free encrypted email service. An idea would be to create an account there for your hosting provider... Also they don't have such thing as forgotten password procedure... if you forget your password, that's it!


Implications of securing data in RAM Someone told me that his company is storing all application data (at least the sensitive data I guess) in RAM for security. Their application runs for long periods of time, so data stays in memory for a long time.
Is it more secure to you keep sensitive data in RAM instead of disk? Is RAM harder to access/exploit, or is it just because it's volatile?

Keeping information in RAM can enhance security, if done right and if the requirements allow it. I'm going to show two security architectures where keeping the data in RAM provides a security benefit. These are fairly specific scenarios; most of the time keeping data in RAM doesn't help.

Protection against file dump attacks

Consider a web application that manipulates files on the server. One kind of vulnerability that it might have is to allow users to download files that are not supposed to be exposed remotely at all. If a piece of critical data is only stored in the memory of some process(es) (here it's not RAM that's relevant, but virtual memory as opposed to the filesystem), then it will not be revealed by a file exposure vulnerability.

Of course, the data may be revealed through other vulnerabilities, for example with an attack chain that first arranges to have the confidential data written into a file (such as an error dump of some kind) and then to have the dump file exposed.

Keeping the data in memory only helps if it isn't loaded from a file in the first place. Where do you get the data after boot? The data could be stored encrypted, but that requires someone to enter the decryption key after a reboot; this is no good for most web applications as they can't afford the downtime. The data can be stored in a file that requires additional privileges that the web server does not have: the web server process would start with elevated privileges, read the file, then drop privileges. This raises the bar for an attacker since they would have to find a local privilege escalation vulnerability in addition to the remote vulnerability that gave them a foothold. The benefit remains small because many attacks that give the attacker unprivileged local access also provides a way to inspect the memory of active processes.

Defense against some attacks with physical access

Information in RAM disappears if the RAM is powered off. Hence, if the attacker can only manage to grab hold of the target system by powering it off, he will have more trouble accessing data if it's only in RAM. However, storing the data in RAM won't do much good on its own, because RAM has some data remanence of a few seconds to a few minutes. (See also Recover the prior contents of RAM from a turned-off PC?). This is enough to reboot the computer into an operating system that's controlled by the attacker or to transfer the RAM sticks into another computer. (See also Are there volatile memory chips which dont retain data after power off?)

Encrypting the data helps, but you have to store the encryption key somewhere. And if you're going to encrypt the data, you can do this on a disk anyway. Encrypting most the sensitive data does help in that if the attacker is unlucky enough that the key is lost, the data is safe.

So in order for storing the data in RAM to enhance security, there have to be additional physical security measures. If the RAM is inside a tamper-resistant case that causes the power to be turned off if opened, it might be enough to exceed the RAM's remanence. For better results, tamper attempts should cause the motherboard to zero out the RAM before turning off the power (which means the motherboard should have a small battery). Encrypting the data helps because then only the key needs to be zeroed out, which takes less long. Even if the anti-tampering measures can be defeated with good enough tools, it makes the attack more difficult than a simple pass-and-snatch (an intruder with a bolt cutter is more noticeable than an attacker with a circuit board inside a cellphone case).

Going further, it can be worthwhile to encrypt RAM, and ensure that the key is kept in the processor cache or registers. The attacker typically has to reboot to try obtaining the key; rebooting quickly enough to find a pristine cache and without clobbering the cache is harder, and unplugging the CPU is harder than unplugging RAM.

There is of course always the problem of where the data is loaded from (or if it's encrypted, where the key is stored). Some use cases value confidentiality over availability and can afford to require someone to come and enter a key after each reboot (e.g. a big datacenter might have someone available to do it around the clock, in case an intruder gets that far). This security measure can also benefit systems that process data but do not store it.


Are the online bitcoin wallets secure? I have an online bitcoin wallet. I sometimes read news about some online bitcoins wallet websites getting hacked. For sure when this happens, all the bitcoins of all of the users are stolen. Articles like this corroborate this.

I guess there is no possibility of reclamation after that kind of incident on an online bitcoin wallet website. I guess they have all pretty controlled on their disclaimers.

So my questions are:

If a bitcoin is finally a hash that can be in a file that can be stored offline anywhere (on my local PC or on an external HDD), what advantages do I have for using an online wallet? Why to "expose" it?
Is there an online bitcoin wallet never hacked yet? Which one?

Is there an online bitcoin wallet never hacked yet?

I'm sure there is. But even if you pick one of them, you're trusting money to yet underregulated/undercontrolled institutions which might misplace your money, be it through incompetence or by design, disappear tomorrow, or, as you say, get hacked, and you will have basically no recourse. There are very good reasons why the traditional banking industry is heavily regulated.

So I'd suggest to not put your trust in any one such wallet, but split your bitcoins among several, so you won't be left out hanging to dry in the rain when one goes down. I'd also suggest a preference for those online wallets under the regulatory domain of a countries that have the legal framework to deal with them (which might be difficult just yet).

Or keep most of your bitcoins in a wallet at home, make regular backups, keep one of them in a secure off site location and only transfer as much bitcoin into an online wallet as you need. Basically, it's the exact opposite of what I'd counsel someone who asked me where he should put is cash to keep it safe.


Why not allow spaces in a password? "Your password can't contain spaces."
is a message I see from some websites,
including 1 .

Why?
(This question is very similar to Why Disallow Special Characters In a Password? , but the answers there don't seem to apply to the space character).

Some systems apparently strip out all spaces before hashing the password.
( How does Google not care about "spaces" in Application-specific passwords? )

Why not simply hash whatever the user typed in, spaces and all?

I can't explain it as anything beyond legacy madness, or lazily copying username restrictions to password restrictions without forethought.

Any block of data, printable or otherwise, should be acceptable if you're hashing your passwords. The only restrictions should be a minimum complexity and a "sanity" maximum length so somebody doesn't soak up 1MB of bandwidth (and the corresponding CPU time to hash the input because you use a slow algorithm, right?) every time they login.


how to extract a valid digital certificate and put it on other program I am working on this matter as a graduate, but I need some help.

how can extract a valid digital certificate to put it on other program?
can I put a digital certificate on other executables and be valid?

I tried disitool by Didier Stevens:

disitool.py extract signed-file signature

But it is not a tool to digitally sign executables: I use signtool for this. When you add or copy a signature from one file to another file, the signature will not be valid.

I also tried MimiKatz  but I can't find success, see  hackcon2013-Dirty Little Secrets They Didn't Teach You In Pentesting Class

What you're asking to do is possible but quite difficult. First of all you need to understand a few ideas so here we go.

Firstly, signature schemes. You've no doubt looked at digital signature schemes on the web and you might rightly ask - so why don't you just sign the whole file? Well, the answer to that is that in at least the case of RSA, you open yourself up to existential key-only forgery attacks. That is, I can generate valid signatures for different message pairs just by knowing your public key.

The solution to this is to use message digests - hashes, in other words. A cryptographically secure hash function is one that not only has preimage, but collision resistance.

So now to what you (and the NSA, and the entire Russian criminal underworld) want to do. You want to pass off a signed file as having a valid digital signature using a digital signature you found somewhere else. Okay. There are two things you can do:

You can take their public key, generate a valid message/signature pair, then try to find a pre-image of the hash that actually works. Good luck. There are no pre-image attacks on even MD5, that I know of.
You can try to find a collision with the hash value they used, and just cat the signature on the end.

Number 2 is exactly what the authors of the flame malware did - they took a valid signature and exploited an MD5 collision to make it valid.

With a whole executable that works, I hear you say? How did you not segfault?! Well, hold up a minute. See, digital signatures underpin the entire chain of certificates from root CAs down to your code. You trust root CAs because they're in your local store. You trust things they sign because their signatures are valid. Those "things" can be intermediate certificates, which can then sign other objects. You trust the chain because when you check each signature, they're all valid signatures that can only be made with the private key.

So rather than find a collision with the hash of the binary, do it with a hash of another certificate and use that collision to let you generate a cert that can sign anything and be valid in the chain.

Unfortunately since the NSA someone already did this with MD5, the world has discovered the problem. MD5 certificates are a thing of the past now and SHA1 is even being sunset, but, just in case. To the best of my knowledge, right now, nobody knows how to generate valid SHA256 collisions on demand.

So, you need to a) target the certificate chain, as ASN.1 parsers are evil and b) break SHA256.

If you want to try to reproduce this, I would recommend a copy of Windows XP which still accepts MD5 certificates (don't let it do Windows update), generate some MD5 certs with openssl then try to reproduce the flame outcome :)


How to securely, physically destroy a hard drive at home? Hard drive in question has sensitive unencrypted data but has failed and no longer responds so can't be wiped.

I'd like to physically destroy the said hard drive (3-1/2" desktop, spinning platter drive) before discarding it. What "home remedies" are good options?

EDIT: To the close voters: None of the other similar questions talk about techniques one can perform at your everyday home (hard drive degaussers, industrial shredders etc). IMHO this question is similar but uniquely distinct.

EDIT2: We're not talking about corporate data, national security data or personal banking data. Encrypted backups mostly, with some unencrypted personal identifiable information when the said drive was used to migrate data.

You want fast and simple?

Step 1: Try and take it apart. If you have the right screwdrivers, great, if not, just go to the next step.

EDIT2: Also use sandpaper on the platters before smashing them. It's very hard to smash into small enough pieces, and very hard to sand afterwards. If you can spend a bit of money, there are also dedicated kits, such as DiskStroyer which provide instructions. Apparently, they also provide a magnet and screwdrivers.

Step 2: Have at it with the biggest, heaviest metal hammer you have. Hit the platters a few times and it should shatter. (EDIT: NB: Make sure you smash the logic board (all the green stuff) up decently as well. Modern HDDs have 32-64 MBs of cache, and SSHDs have around 8 GB, and we don't want anyone to get a single bit)

Step 3: Find a big magnet and go over the disk a few times.

Step 4: Find a really hot flame, and melt the data off. A good gas flame can get up to 1200 °C, easily enough to demagnetise even the toughest materials.

And you're done! Send your now thoroughly unusable drive into the bin, or a recycling center, or whatever else you do to dispose of electronics.

EDIT: To be completely honest, I would do this to an encrypted drive as well, with the logic that any drive needing encryption should be disposed securely to prevent the exploitation of vulnerabilities in the encryption discovered in the future.


Macbook pro, rootkithunter I've never really tried to understand rootkit enough, I'm too much paranoid...

I recently reinstalled mountain lion, but my EFI might be infected.

I have a macbook pro, it was really slow at some point that week, I could not manage to make an Apple Hardware test, it was weird since I have mountain lion.

Are there known false positives for rkhunter ?

Oddly downloading chkrootkit brings a "Unable to connect" error in firefox, I'm a little worried.

Here are some selected lines from the rkhunter log

Performing file properties checks
  Checking for prerequisites                               [ Warning ]
  /usr/bin/fuser                                           [ Warning ]
  /usr/bin/whatis                                          [ Warning ]
  /usr/bin/shasum                                          [ Warning ]

Performing check of known rootkit files and directories
  Dica-Kit Rootkit                                         [ Warning ]

Performing additional rootkit checks
  Checking for possible rootkit strings                    [ Warning ]

Performing system boot checks
  Checking for system startup files                        [ Warning ]

Performing system configuration file checks
  Checking if SSH root access is allowed                   [ Warning ]
  Checking if SSH protocol v1 is allowed                   [ Warning ]

Performing filesystem checks
  Checking for hidden files and directories                [ Warning ]

Here is the full log
http://pastebin.com/x0A2XVFi

PS:
I would kind if an OS X user could run rkhunter on his machine to check if there also are false positives...

rkhunter is pretty old and you should pay people to perform security analysis on your systems.  Try running it against a fresh install,  and diff the results with your run.    That being said,  this is still no guarantee that you are safe.  If you suspect you have been rootkit'ed then you should reinstall OSX.


DHCPig not making the hosts discard IP configuration In DHCPig I have the option to send RELEASE packets to all hosts in the network. This should result in the hosts discarding their configuration.

This is the command I ran:

pig.py -r eth0

I did run this attack but the hosts did not discard their IP configuration. Does anyone have an idea how to operate it?

You did misunderstand the attack. The faked packages aren't send to the client. They are sent to the server with the address of the client you want to dos as the sender. The goal of this attack is to make the server believe that the address is available again. This will only work if you prevent the real client from communicating with that server.

You can find a documentation of how this is best done here.

// When a Host obtains a DHCP lease there come some limits with it. The lease has a lifetime after which it expires if it isn't extended. But there is also an additional time limit which is called renewal time which is the time limit after which the client should talk to the DHCP server again to extend the lease. Many operattion systems even renew their lease more often than imlied by the renewal time.

When you now start portstealing your target and send a RELEASE Packet to the DHCP server the server will mark the lease as available again. You then start aquireing this lease with a fake mac address using DHCPig. When the targeted client then talks to the DHCP Server to renew his lease the server will send a NACK packet which will prevent the lease from beeing extended at least and might cause the client to discard his configuration.


Fraud detection to avoid fake users I know there is no 100% solution for fraud detection, but at least I want to set some level of confidence in this use case.

Suppose that I have a system where:

A user need to make a registration
A user can only post one review per company product

I am doing 4 steps to avoid fraud (e.g. multiples posts from fake accounts):

  Step 1 - Each account allow only one vote per product.

  The malicious user need to create multiples accounts to fake reviews.
  He need a new email to create a new account.
  He have to complete the google recaptcha

  Step 2 - invalid review if this combination is true:

  user IP + user browser fingerprint combination already exist for the chosen company product (using the IP to avoid collisions of browser fingerprint)

  Step 3 - invalid review if this combination is true:

  same user IP used for the chosen company product in the last two days

  Step 4 - If everything fail, the user can post a review:

  In moderation area, if same product has a duplicated fingerprint, then the review will be marked as potentially faked and needs to be approved accordingly

Is there a simple way to improve this mechanism of fraud detection?

Any advice about fingerprint collisions?

Edit: If your website is about crowdsourcing, you probably should have mentioned that in the question right away because that's a very specific topic and different from online vendor scenarios.

Yet the solution remains the same. The simplest way would be to hold any verified activities for each user in a database and thus verify if a user really has accomplished something. That's how shops like Amazon and crowdsourcing projects like Wikipedia do it and it's not really hard to implement either, especially when all users need to register anyways.

You will always have data such as member ID or project ID which can be mapped 1:1 to an existing person. I can't even imagine a company where the owner doesn't even keep track of the participants of his business.


Potential added risks of using Docker in production servers What are the added security risks of using a dockerized container to deploy a production server?

Not interested in risks that would exist anyway in deploying a production server the traditional way,but only to risks potentially added from the use of a dockerized deployment. Note the user active within the container is different than root and is one that doesnt have rights to install anything or make changes outside their given working directory. Assume that our image is build directly from an official OS image, and all other software installed is hash checked and that we will only install on it the bare minimum needed to run our web app.

Also, what are some good practices that should be followed when setting up such a server through Docker to ensure maximum security?

Regarding the point of the good practices for Docker deployments, you can run the CIS Docker Benchmark which performs a set of automatic tests to guarantee that the CIS Docker Guidelines are compliant in your Docker containers.
You can get these guides for free at: https://www.cisecurity.org/cis-benchmarks/

This can give you a good overview of the things you can tweak in your Docker config to improve security and also learn a lot of things that you probably haven't heard before about Docker (at least that was my case).

Also the official Docker documentation has a quite good document related to securing Docker containers. You can find it here:
Introduction to
Container Security

Keep in mind that some of the settings may be quite restrictive (with the impact that this may have) and also some recommendations are based on very new and likely unstable features. Here you have to determine the balance between security/usuability as usual.


HTTP Headers: Document Policy vs. Permissions-Policy/Feature-Policy I'm checking the options to harden my web app by setting the appropriate HTTP headers.
Besides the Content Security Policy (CSP)  there are two another approaches: Document Policy and Permissions-Policy (Feature-Policy).
I've checked the W3C Relation to Feature Policy documentation, but still can't grasp the clear answer wherever I need to set both policies: Document and Permissions or it is overshooting and it's enough to set just Permissions-Policy?
P.S. Feel free to forward this question to the SE's Web Applications or StackOverflow portals, if the question doesn't fit so much this portal.

Document-Poicy is for more performance/best-practice options. Permissions-Policy is for handling "powerful" features that you don't want third-parties or new devs using.


Hide RAT in a picture link in a document? Is this possible?  A friend tried to install a rat by sending me a file that looked like 049.jpg.exe but i didnt click on it cuz of the .exe in the end.

This was just for fun but it made me Wonder, can you hide a rat completely so The victim doesn't see The .exe?

If I wanted to give him a rat,  would it be possible to make a custom link and hide The rat in it so when he Clicks it he get infected without notice?  Like send him an email " your picture www.facebook.com/089jpg-anthonynude is violating our rules and we does not tolerate nude or pornographic content. / Facebook "

You can't trick Facebook, because it looks into the file contents to determine its type. Moreover, pictures uploaded are automatically converted into another format.

Historically there was a related vulnerability in some versions of Windows, which simplified .jpg.exe tricks. If you included an RTL (right-to-left) character in the filename, it would be parsed right to left, so a file named as exe.something.jpg is seemingly a JPG file for the user, but it executes when clicked on.

Besides this, I don't know any other possibilities that a file with the right jpg extension would execute.


Is this somebody trying to exploit a vulnerability? On our website, when an invalid PHP session ID is detected, it's logged and regenerated.

This invalid session has been logged:

n040jl1nujch72tkrmr0uilnl1, s_vi=[CS]v1|2A19B9B4853135D2-60000109E00013F4[CE]

Is that somebody trying to exploit a vulnerability?

This is the current way the ID is regenerated

// If it's invalid, generate a new ID.
$chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,-";
srand((double)microtime()*1000000);
$i = 0;
$pass = '' ;
while ($i<=35){
    $num  = rand() % 33;
    $tmp  = substr($chars, $num, 1);
    $pass = $pass . $tmp;
    $i++;
}
session_id($pass);

But in the next few days, we're updating the codebase to use this is it needs regenerating.

session_id(uniqid());

Do you write in logs which session IDs are generated?

Maybe 'good' user got this session id from your application, but then application 'forgot' about this? (because session expires or because application was restarted, server rebooted)

Simple guessing sessions id few times isn't very good way to hack site, maybe some tool like Splunk could greatly help you. (e.g. it can show that 99% of invalid session id error comes from requests from single IP - then it would really be suspicious).


Acronym CSRF refer to token or the attack itself? I am really confused of what CSRF is. I know it stands for Cross-site request forgery. http://en.wikipedia.org/wiki/Csrf

When you read it here it talks about cross site request forgery attack. But sometimes people use it to refer to the randomized string or token generated by server to make sure each request is from correct issuer.

If it is a token, my understanding is it can be stored in a cookie or http header. When it is stored in a cookie does the token name always have to be the same? Is there standard
token name I should be looking for like CSRF=!@#(@!#@(!#JIJ@#KLJKLJLJ. In my particular application I see __RequestVerificationToken_ followed by bunch of random characters. Is that CSRF? Can you name your CSRF token name to whatever you like?

PS: So I guess people can use CSRF token or CSRF attack to differentiate between the two. But if they just use CSRF which one are they really referring to?

CSRF is the attack.  A countermeasure to the attack is implementing CSRF tokens.  These tokens are intended to prevent CSRF attacks from working.  If someone just says "CSRF" they're probably talking about the attack but you'll have to determine that yourself from the context of how it is used.

Your application (or framework in some cases) is what needs to know what CSRF token to expect.  So the name of the cookie or parameter isn't important as long as your app knows what it is.  There isn't a standard name that has to be used.

Here's another question and answer about preventing CSRF that gives you pointers on fixing the issue.


I need to compute a string whose SHA256 hash matches a given prefix. How should I approach it? Is there any (more efficient) way for computing any string with a given prefix in it's SHA 256 hash? And how probable am I to stumble on such a string if I brute force?

If I have understood your problem correctly (from the clarification in your comment), in short, brute force will be your only option. But if you know a few boundaries to the problem and you don't mind storing some (potentially very large) amount data you can try to make shortcuts for yourself for the future.

If, for example, you know that you will only ever need to match a maximum prefix length of, say, 32 bits, then each time you calculate a hash that doesn't match your target, save the string and the 32 bit prefix into a table (discarding duplicates, of course). Then, with each future search, you can search for the required prefix in your table to see if you've precalculated it, before resuming your brute force search from where you left off.

Sadly, there's no way to use your precalculated prefixes to exclude candidate strings (such a thing would count as an extraordinarily strong defeat of SHA-256) and shorten your search. My advice would simply be to brute force your way through every 256-bit starting string beginning from all zeros.


Overflowing a cookie returns error page in PHP A PHP application that I am currently testing returned and error page when the value of session cookie is set as a huge string. It leads to information disclosure also. What can I recommend the developer to prevent the generation of error page when the cookie value is overflown?

The problem is caused by the app expecting the cookie's value to be something without first checking if that value is indeed something to be able to exit gracefully if it's not, and instead ends up throwing an (unhandled) exception.

What the developer should do first is to disable error display on the production servers and instead just returning a 500 error with an optional user-friendly error page, or at least a blank page to avoid information disclosure.

I don't think there is a need to explicitly validate the cookie's value, this isn't something an user can input and make a typo so there's no need for validation and an error page like "cookie not valid", someone would need to intentionally modify that cookie's value in which case it's normal that the app isn't expecting that and just throws a 500 error - as long as PHP is correctly configured to not disclose sensitive information on error and instead log it.


Tor and remote desktop viewing If I am using tor for anonimity, does this prevent staff at a place of employment or an educational institution from remotely viewing my desktop and seeing what I am doing on Tor? If so how can I get around this?

If someone else has software installed on the computer you are using that allows them to view your screen than Tor will not prevent them from doing so.

If used correctly Tor will make it very difficult to associate your internet traffic with you and people snooping on that traffic will not know you are the one it is directed to. But, if an attacker has spyware on your computer that wont matter. They will presumably already have access to your computer and be able to see and record everything you are doing.

Potential alternatives are to use Tor on your own computer that doesn't have spyware installed on it by an educational institution. However, if you are using a school computer and internet connection there is no real way to garuntee that you aren't being snooped on.


Why is cross site scripting in URL dangerious if I don't use cookies? I currently have an XXS problem in this site.

https://bbcpanningen.cupweb6.nl:1311/servlet/OMSALogin?msgStatus="><script>alert("hello")  </script>

But I don't understand how an attacker can exploit this.
The sites doesn't use cookies so that might be a problem.
I've read something about it, and they all said the attacker had to send a link with the XSS in it.

There are a lot of other dangers from XSS, not just stealing cookies. Your page could be defaced, data which is secured (for instance with ip-protection) can be stolen or it even can be used to do some time-based attacks on internal networks the attacked browser may be connected to.

So you definitely should have a look at the OWASP XSS Cheat Sheet to protect against things like these.


Will this setup give better anonymity and hide tor usage? Computer 1 with IP 1 (traceable to owner) connects remotely to Computer 2 with IP 2 in another country (assume computer 2 and IP2 cannot be traced back to original owner - bought using cash/bitcoin).

The only information exchanged between the 2 computers is:

Keyboard and mouse inputs from computer 1 -> computer 2
Computer 2 sends video of screen output to computer 1

Data sent between both computers is encrypted. Computer 2 only accesses websites through the tor network.

Is it correct to assume that this setup will prevent:

Javascript exploits and browser fingerprinting: Malicious party can only fingerprint the 2nd computer.
DNS leaks: Can only identify the IP address of the 2nd computer.
Hide tor usage: Pluggable transports, obfs4 and meek are used to bypass censorship but are not recommended to hide tor use.

Obviously a powerful enough adversary could simply correlate computer 1 with computer 2 but ignoring this would this setup provide an additional layer of privacy?

In many (possibly most) cases yes, it will give better anonymity, but keep in mind that:

some degree of fingerprinting correlating the 2nd computer to you is possible through the analysis of your keyboard and mouse usage alone (even just mouse movement), and from your interaction with individual or multiple sites, when these interactions use the same Tor circuit
as you hinted at, the other fingerprinting methods will still be employable, they'll just won't be correlatable to what you've done and do through other devices. But all the activity you do through the 2nd computer will be correlatable.
Javascript will still be possible on the 2nd computer
either through Javascript or other ways the 2nd computer might get hacked, which would:

possibly facilitate hacking computer 1
allow to spoof anything that is being sent to computer 1, so that for example you might be thinking that you've posted something to a site, when you actually haven't
allow interception of anything you do through it, including for example the interactions with TLS sites
through the interception, facilitate your identification (analysis of anything you do with the computer, not just within the browser)
easily allow to see, even remotely, that it is communicating with computer 1

any adversary that can look at the 2nd computer's communications will get to know about the first one
of course, as you mentioned, the global adversary can always correlate
If you don't have physical control of the 2nd computer you don't really know what it's doing: it might well be sending all your traffic to someone, it might have backdoors/out-of band management facilities, and in general it might be very easy for someone else to interact with or spy on, even without any "hacking".

The hacking point means that you should care about the 2nd computer's security too.

The last point is instead actually a very serious threat that this model introduces.

For all your aims except Tor hiding and DNS leaks it would be better, with no drawbacks, to use a computer more under your control.

DNS leaks are easily preventable in other ways (Tor or VPN proxy), so I would ignore them here.

For Tor hiding you should keep in mind the alternative of passing through a VPN (either commercial or set up on a "2nd computer").

This has the drawback that it might be possible to detect Tor usage through traffic analysis (of the traffic between you and the VPN alone).

So ultimately you should balance the threats:
is it more likely and risky that my mere Tor usage gets detected by an adversary other than the global ones or the ones in control of the VPN/2nd computer (who have always other means of detecting it), or that the 2nd computer is accessible to or hackable by an adversary (which allows the interception, in clear, of everything you do through it)?


Why do so many cracking attempts originate from China? I recently put a Linux server online and it didn't take long until I had the first attempts to brute-force the SSH login. It's not that I am worried about that - I trust the security of my server. But just out of boredom I looked up some of the originating IP addresses and noticed that almost all of them were Chinese.

Why is it that so many cracking attempts originate from China?

Does China provide an environment which is favorable for cybercrime to bloom? Or are we actually dealing with people from other countries who just like to use botnet zombies from China? In any case: The Chinese government is known for its ability to censor the internet access for their people. Why don't they use that infrastructure to shut down the criminal activity originating from their network?

First, China has lots of people. It has more than 4 times as many inhabitants than USA. Then lots of them are young and well educated and smart enough to do hacking. And while I'm sure that China has tough laws against hacking of chinese infrastructure, it might even profit from hacking outside infrastructure. This way of thinking is not specifically chinese, just remember privateers or recent hacks against brazil by anonymous with the help of the FBI.


How can I avoid getting exposed while travelling to Russia? UPDATE: There is a similar question, but my question is different because it is very narrow and about a very specific security concern. In short, I used a laptop to make posts on a Russian social network (vk.com) from Japan and am now travelling to Russia with the same laptop. My specific concern is how I can exclude the possibility of being identified, in Russia, as the author of those posts. I am afraid that if I connect my laptop to the Internet in Russia, my laptop might leave some "fingerprints" in Russia coinciding with "fingerprints" I left when I made those posts from Japan. The answer given to the question referred to above does not address my concern at all.

More details are below, in the original text of my question.

I am a Japanese student learning the Russian language and will soon travel to Russia to have a kind of internship or training.

I have a security concern and a background to it. The background is that I actively participated in Internet discussions on the Russian social network vk.com under a fake name and made many provocative posts there, so a number of people explicitly wrote there that they would do their best and utmost to find my real identity and make it public. My posts are definitely of no concern to police and were not even deleted by the admins, but quite a large number of people got really agitated as my posts were about politics, religions, cultures, and similar sensitive stuff and written in a provocative manner. I cannot afford getting my real name publicly associated with those posts, but I did not see how people could find my real name, so I even made some posts saying they would not be able to find my name.

Some time ago one Russian sent me a message telling me he had discovered my real Japanese IP addresses, and he told me some of them. Although I had not used any proxy servers to make my posts, I got shocked, because vk.com is not supposed to share my IP addresses with anyone. The guy then wrote he had been able to find my IP addresses because he works in a Russian company that has access to a lot of data related to the use of the Internet in Russia. He added that he had somehow tried to find my real name based on my Japanese IP addresses, but had not succeeded. Indeed, my Japanese IP addresses do not give any leads, and no Japanese provider will tell my name to Russians.

Now I am travelling to Russia and intend to use there the same laptop I used to make my posts; I will be given an Internet connection in Russia and, in view of what the guy told me, will obviously need to avoid any possibility of leaving any traces in Russia that could link my Russian IP address with my past posts. The reason is that knowing my Russian IP, people might find my real name by contacting my Russian hosts. Ideally, I would like to continue using the same account in the social network to make posts while staying in Russia.

My question is this: What should I do to meet these needs?

I am asking because I know little about such security matters and, in particular, what kind of information is collected from my laptop by Internet providers and servers such as vk.com, so I am afraid to even connect my laptop to the Internet in Russia. I humbly hope that security experts of this SE could kindly instruct me how I can safely use my laptop in Russia without any risk of getting exposed in relation to my past posts made from Japan from the same laptop, given that at least one Russian who wants to find my real identity may have access to any data related to the use of the Internet in Russia.

Now I am traveling to Russia and intend to use there the same laptop
I used to make my posts

I am going to write the answer assuming your laptop hasn't already been compromised with a rootkit/malware.If it has either nuke it or format HDD and preferably use linux live.
Now to your question

My question is this: What should I do to meet these needs?
any possibility of leaving any traces in Russia that could link my
Russian IP address with my past posts

Simply mask your IP address with a VPN and use tor browser on top it to avoid any browser finger printing.Also change your DNS server to either 1.1.1.1 or any other google DNS servers.This should be sufficient if you don't make any other mistakes.
**What are those mistakes?**
You say that you will be using the same account when you are in russia as well.Your mistakes could range from something super stupid like sharing your location(Like i said use tor browser) or sharing a photo of your nearby place.DONT MAKE OBVIOUS MISTAKES.You could also be social engineered via social networking VK.COM via messaging,ads or any other social engineering attack vector to compromise you.HERE CLICK THIS LINK.You could also make configuration mistakes which could lead to IP leaks.If you are that much paranoid you could use an operating system such as Tails which is made for privacy.This might be an overkill in my opinion,obvious mistakes are what you should be looking out for.
WHY DO I THINK VPN PLUS TOR BROWSER SHOULD SOLVE 99% OF YOUR PROBLEMS?
Well for starters an attacker would have to be very very dedicated in trying to compromise you and how would the attacker even know that you are in russia if you simply configured your VPN well.Lastly I would also advice you to not share on your social media that you are in russia and not agitate them into trying something.


Do all files downloaded from the web, come with a checksum to verify the file? Pretty straightforward question. Take the image here:
https://i.imgur.com/oEdf6Rl.png
Does it come with a checksum, which I can verify against after I have fully downloaded the file?
This question goes for any file downloaded, and in my particular case; I do not care if the file on their end has been corrupted, but rather that I can check BEFOREHAND what that file's signature / fingerprint / digest / hash is; Can I do that?
The reason I want to do this, is because I want to bank those hashes and put them into a database, where I can ascertain if I have downloaded that particular file before hence saving bandwidth. Thanks.

Does it come with a checksum, which I can verify against after I have
fully downloaded the file?

No, random files do not come with a checksum.  Providing checksums to go with files is usually only done for executables and installation media.

check BEFOREHAND what that file's signature / fingerprint / digest /
hash is; Can I do that?

No, you can only checksum a file after you've downloaded it.

I want to bank those hashes and put them into a database, where I can
ascertain if I have downloaded that particular file before hence
saving bandwidth.

I'm afraid what you're trying to do simply isn't supported.  And to an extent, web browser caching provides bypass of redundant image loads already.


Is it possible to detect password length from hash? Does doubling your password add more security? Assuming a service doesn't store a plain text password, am I right in saying that the answer to this question depends on the service? On a bad service, the hash length is related to the password length. On a good service, they're unrelated. That's my guess.

Also, to what extent does doubling a password increase security? So instead of using password, how about using passwordpassword?

Please note, I'm not an expert, so a user-friendly explanation would be welcome.

If the length of the hash varies depending on input, then it is not a hash. A cryptographic hash function, by definition, offers a fixed-size output, regardless of the input. For instance, SHA-256 offers a 256-bit output, always; never more and never less.

Password hashing is a specific activity which is often discussed in this site. The short answer is: use bcrypt. It handles the fine details properly -- and there are many.

As for "doubling" the password, it adds security only insofar as you may elect to do it or not to do it, thus doubling the size of the space of possible passwords. If you do it systematically, then no, it does not increase security. Also, password length may leak (when you type a password, your office colleagues may easily hear the number of keystrokes, for instance).

The strength of passwords does not come from length or special characters or other traditional rules; a password is exactly as strong as it could have been different. The number of possible values for a password (given your method for generating the password) is the key parameter. Anything "witty" here is a bad idea: remember that we must assume the attacker to be always as smart as you. So don't try to make passwords with an idea of "the attacker will never think of that !": the attacker already thought of it, before you.

A good password is generated randomly, with dice, coin flipping, your cat chasing a toy mouse over a plank which has been divided into numbered areas, or even, should it come to that, with a computer running a random number generator.


Is sending authorizing links through e-mail a vulnerability? I am not sure if my wording is right, but if I attach a unique token inside email links which will authorize the user if clicked, would you consider this a vulnerability?

Password-reset partly includes this. That link authorizes you to reset your password, but here I am talking about a more long-lasting link.

I have no particular implementation in my mind currently, but I always have thought entering credentials after clicking a link is a cumbersome process.

That way we lose the ability to mass-email the exact same email, and maybe the vulnerability occurs if we use an external mass-mail service (like most probably), or the receivers mail setup allows sniffing somehow.

Has anybody weighted ups and downs?

The problem with this is that in current practice, e-mail is not really a very secure channel to send this sort of information. There isn't much of a way around this, short of convincing the overwhelming mass of humanity to drastically change its e-mail habits. That's probably never going to happen, so we have to live with it as best we can.

If an "authentication" link expires after a short time, then the risk of a leak is minimal. It is very unlikely that anyone will get into the e-mail account between the time the e-mail is sent and the time the user sees it. It also helps if, once the link is clicked, it immediately expires, because this makes the window of opportunity even shorter.

For such purposes as password resets, this is typically considered "good enough." In these cases, the window of opportunity for an attacker is very short, because the user had to deliberately trigger the link's creation, and we told him to check his e-mail. Chances are, he'll check it and click the link within minutes. That's what we want.

But the longer that link stays active, the greater the risk that someone else will see the link first. If they use it, you're trouble, because you have no way to know that this is not the user you intended the message for. That's the security-based reason why it's not a good idea to use a long-term authentication link.

There's another, more pragmatic reason: how will the user remember which link to use? If the user has to memorize or type his own authentication URL, that's at least as difficult to use as a password, plus the user will need to type it into places where it won't be hidden. If we rely on the user to make a browser bookmark, then as soon as the user has to deal with multiple machines (barring browser sync mechanisms, which present their own problems), the bookmark gets lost. If the user has to go through his e-mail each time he wants to log in, that's another user/pass dialog to go through, and even though it's not one we have to worry about, we still haven't saved the user any time.


Port filtering for Ubuntu-Nginx minimal server environment I've established a minimal, uncustomized LEMP stack (Ubuntu 16.04). The only server I have besides Nginx is Postfix. To protect that environment I filtered all ports besides a few, this way:

ufw enable
ufw allow 22/tcp 25/tcp 80/tcp 443/tcp 9000/tcp
ufw allow 53/udp

I wonder if I shouldn't go 1:1 by means of tcp:udp.
I wonder if I should distinguish incoming/outgoing for tcp/udp or both.

Is my filtering correct?

Since you're using UFW, it's a greatly simplified firewall interface compared to, say, using iptables directly.  Consequently, it does some "magic" for you:

Blocks all incoming traffic by default.
Allows all outbound traffic by default.
Allows some incoming traffic (packets that are related to or part of an established connection)

Then, the rules you create are incoming rules only, but the outbound part will be allowed because all outbound is allowed by default.  So your rules are to allowing incoming traffic.

  I wonder if I shouldn't go 1:1 by means of tcp:udp.

There's no reason to do that.  HTTP, SMTP, HTTPS never go over UDP, so why open holes in the firewall you don't need?  Of the ports you listed, DNS is the only one that might use UDP.  (Note that you only need to allow 53/udp) if you're hosting DNS, not to access an upstream DNS server.  (And if you're hosting DNS, you should allow 53/tcp as well.)

  I wonder if I should distinguish incoming/outgoing for tcp/up or both.

As noted above, UFW does incoming rules by default, so you are distinguishing, it's just not obvious because it's part of the "uncomplicated" nature of UFW.

I assume you're running something on port 9000 that lead you to open that port, but I don't know what it would be -- it's not needed for nginx, postfix, or SSH by default.


Need raw certificate/key to sign PDFs via Java app. But vendors seem to only sell HSMs for this. What to do? Our organisation wants to purchase a digital signature certificate for signing financial PDF documents. We want to automate this process, so we'll be having Java code do the signing work. For that the only way, supposedly, is to keep the certificate as a file on the server.

I've contacted many digital certificate vendors and with none it was possible to get a basic certificate file. All were issuing a hardware token such as pen drive, USB dongle etc. which contain certificate file in non-extractable format. None give the option to download.

Why is that? Is there some regulation that digital signature certificate can only be given in form of hardware token for security reasons? If not, then which vendors allow to download certificates on system?

Any suggestion or reference is appreciated.

Is there some regulation that digital signature certificate can only be given in form of hardware token for security reasons?

I'm not sure what Adobe requires of you but it seems to hint in the "secure hardware only" direction.
If you want to use Adobe Certified Document Services, then indeed, you must fulfill some requirements:

6.1.5 Key Sizes
CDS Subordinate CAs shall use an RSA key pair with at least 2048 bits.
CDS Subscriber certificates shall use an RSA key pair with at least 2048 bits.

And further on this: (line breaks added for readability)

6.2 Private Key Protection
6.2.1 Standards for Cryptographic Module
Standards for cryptographic modules to be adhered to in the CDS PKI are decided by the Adobe Policy Authority.
CDS Subordinate CAs must use cryptographic hardware modules that meet or exceed FIPS 140-1 Level 3 standards.
CDS Subscribers must use cryptographic hardware modules that
(a) meet or exceed FIPS 140-1 Level 2 standards or
(b) for which the cryptographic hardware module manufacturer has applied for FIPS 140-1 Level 2 status within the previous year without receiving a notice of noncompliance or other communication indicating that such device fails to meet such standard.

But: I don't know if "Adobe Certified Document Services" is indeed the only way to get a PDF signed so that it will be recognized by Adobe Reader out of the box.
There may be other ways. I don't know. But we now know this: if you want Adobe CDS, then you need special key storage hardware.