Showing posts with label app security. Show all posts
Showing posts with label app security. Show all posts

Tuesday, November 30, 2021

How To Secure Flutter Mobile Apps?

 

How To Secure Flutter Mobile Apps

Day by day the popularity of flutter is increasing among developers and entrepreneurs. Flutter has emerged as one of the leading and popular cross-platform app development frameworks because of its integral capability to deliver best native user experience, faster development through code reusability, faster app testing and deployment through high reloading features etc. And when it comes to app development, biggest concern for programmers and customers is security. As most people use mobile apps for shopping, ordering food, and money transactions, it becomes essential to secure your app. Hence here we came with some tips to secure your flutter app. Let’s have a look. 

Know the latest features of Flutter 2.5 at- What’s New In Flutter 2.5 And Dart 2.14?

How To Secure Flutter Mobile Apps?

Flutter logo

1. Secure CI Infrastructure-

You should know what’s going on in your VM’s and workflows depending on whether your CI infrastructure is self-hosted or using services like Github actions.

Updates-

So as to ensure your apps are running in a secure environment, you must keep your VMs up-to-date or be on a lookout for security vulnerabilities.

Secrets-

You should not commit API keys or related sensitive data in your code, rather you add them on secrets settings of your project. Other services such as Bitrise provide the same option to store secrets.

2. Secure Developer Identity-

Files such as keystore, keystore.properties, Google service account or any secrets that can reveal developers identity must be encrypted at all times when tracking in repository.

Create a directory and use GPG to encrypt it.

cd android
gpg --symmetric --cipher-algo AES256 android_keys.zip

Encrypt sensitive files, for example, key.jks and keystore.properties

Ignore and don’t keep track of unencrypted sensitive files.

# Ignore Android keys
key.jks
key.properties
service_account_key.json
Android_keys.zip

3. Secure User Data-

PII(Personally Identifiable information) is the most critical data that you don’t want to store on your apps, because unfortunately,if revealed, the company is in big trouble. But there are some cases where PII is required, for instance, for offline-first apps. Whenever required, you can use flutter_Secure_store to store PII or other sensitive data like auth token.

In short, Flutter secure storage is a package that makes use of Keystore for android and Keychains for iOS. Both of them are considered a standard in terms of security-sensitive data to user’s mobile devices.

Caching-

To store sensitive data other than PII, it will be better to use Hive for performance gain, though it needs more setup. It uses AES-256 encryption that helps you to secure the data of users from unwanted exploit or tampering. 

Tip- To secure the users data, don’t store it in plain text.

4. Restrict Network Traffic-

Generally the apps are connected to the internet, whether to a third-party service provider or to their own servers. Also, the app exchange carried out on a Transport secure layer (TLS) to provide a secure connection between mobile apps and your servers.

Trusted network-

Way to restrict network traffic or connection to an unsecured endpoint is via explicitly whitelisting your domain.

For Android:

res/xml/network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config>
        <domain includeSubdomains="true">example.com</domain>
        <trust-anchors>
            <certificates src="@raw/my_ca"/>
        </trust-anchors>
    </domain-config>
</network-security-config>

For iOS-
ios/Info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <false/>
  <key>NSExceptionDomains</key>
  <dict>
    <key>cocoacasts.com</key>
    <dict>
      <key>NSIncludesSubdomains</key>
      <true/>
      <key>NSExceptionAllowsInsecureHTTPLoads</key>
      <true/>
    </dict>
  </dict>
</dict>

Certificate pinning-

Implement certificate pinning for apps to restrict the secure connection to specific certificates. It ensures that the connection between apps and servers is authentic and trusted. Without certificate pinning, hacker can eavesdrop or tamper data when on transit using hacked or self-signed certificates.

5. Secure API Keys-

There are various formats of keys, but generally it is in the form of a String. If it is not encrypted or obfuscated, it will be easier for hacker to use your API keys.

Read More


Monday, May 24, 2021

How To Secure Your Android App?

 

How To Secure Your Android App?

How To Secure Your Android App

In this digital world, people use mobile apps for a wide range of purposes,  from transfer of funds to investments, order food and groceries online etc. Security of mobile applications is one of the most prominent concerns. According to the study, 35% of communications over mobile phones are unencrypted. This shows that more than one third of data transmitted by mobile devices is exposed to threat.

The Android operating system has many built-in security features like application sandboxing, protection against buffer and integer overflow attacks and segregated memory areas for program instructions and data. When you develop a complex app, it is your responsibility to make it secure and protect the privacy of your users. Organizations should protect their apps while enjoying the benefits that these apps provide. Here we discuss the android app security best practices to refer while building your mobile applications.

You should also know the considerations to build mobile app at- 7 Important considerations when building a mobile app

Android App Security Best Practices-

1. Keep the native code secure-

So as to keep the native code secure, android app developers should use android SDK for mobile app development, instead of Android NDK. Whenever you collaborate with one of the developers, ensure that experts use Android SDK. When the native code is integrated during the development process, app receives data over the network. This can come from files or an IPC, that might be exposed to security factors. Hence you should secure the native code by using Android SDK during the development process.

2. Use HTTPS-

All communication between your app and servers must be over HTTPS connection, mostly using the HttpsURLConnection class. Many android users connect to several open Wi-Fi hotspots in public areas every day. Some of those hotspots could be malicious and malicious hotspot can easily change the contents of HTTP traffic to make your app behave in an unexpected manner or worse still, inject ads or exploits into it. 

Using HTTPS, as long as the server is configured with a certificate given by a trusted certificate authority, like DigiCert or GlobalSign, you can be certain that your network traffic is secure against attacks. If app has huge networking code and you are anxious about the possibility that you may accidentally be sending some data as cleartext, you should consider using nogotofail, an open source tool built by Google to find such mistakes.

3. Secure The Data-in-transit-

Sensitive data that is transmitted from client to server should be protected against privacy leaks and data theft. If you lose a device, or it gets stolen, the whole application containing business data should be deleted. This ensures that important data does not go to the wrong hands. Selective removal of data enables the IT department or users to wipe off the company data in devices. It is recommended that use either an SSL or VPN tunnel, which ensures that user data is protected with strict security measures.

4. Encrypt Data On External Storage-

Internal storage capacity of android devices is generally limited. So, you you may have no option except to store sensitive data on external storage  media, like, a removable SD card. As the data on external storage media can be directly accessed by both users and other apps on device, it is important to store it in an encrypted format. Most popular encryption algorithms among developers is AES(Advanced Encryption Standard), with a key size of 256 bits. Writing a code to encrypt and decrypt your app’s data using package javax.crypto that is included in Android SDK can be confusing. So mostly developers prefer use of third-party libraries like Facebook’s Conceal library, that are usually easy to work with. 

5. Use GCM Instead Of SMS-

A while ago when GCM(Google Cloud Messaging), didn’t exist, many developers were using SMS to push data from their servers to their applications. But now, this practice is largely gone. If you still doesn’t switch from SMS to GCM, you must know that SMS protocol is neither encrypted nor safe against spoofing attacks. Also, SMS can be read by any app on the user’s device that has the READ_SMS permission. GCM is more safe and is best way to push messages to an app because all GCM communications are encrypted. They are authenticated using consistently refreshed registration tokens on the client side and a unique API key on the server side. 

6. Be Extra Cautious With Libraries-

When you use third-party libraries, be careful and test code thoroughly before using it in your app. However valuable as they are, some libraries can be extremely insecure for your application. The GNU C Library, for example, had a security flaw that could allow attackers to remotely execute malicious code and crash a system. And, this vulnerability went unseen for more than seven years. Developers should use controlled internal repositories and exercise policy controls during acquisition to protect their apps from vulnerabilities in libraries.

7. Use Authorized APIs Only-

APIs that are not authorized and are loosely coded can grant a hacker privilege that can be misused gravely. For instance, getting authorization information locally helps programmers to easily reuse that information when making API calls. It eases programmers life by simplifying the use of APIs. Also it gives hackers a loophole through which they can hijack privileges. Specialists suggest that APIs be authorized centrally for more security.

8. Code Obfuscation-

In the android app development process, source code should be protected. So developers should make it unintelligible for both decompilers and humans. During compilation, the entire operation must be preserved. Obfuscation process gives a code that is impenetrable. It uses the level of confidentiality for the intellectual assets and prevents reverse engineering. All the while, it improves the security of the Android application.

9. Secure The Server-

These days, server remains vulnerable to hackers. Mostly they try to attack the API of the server. This shows that you have to keep the server and API secure to keep away attacks. You can add a firewall for web apps or take code reviews that will help you to deal with this challenge.

10. Validate User Input-

With android, invalid user input doesn’t generally makes security issues like buffer overruns. But, if you allow users to interact with SQLite database or a content provider internally uses a SQLite database, you should rigorously sanitize user input or use parameterized queries. It you failed to do so makes your data vulnerable to SQL injection attacks. Similarly, sanitization and user input validation is also important, when you’re using user input to dynamically generate code to run on an embedded scripting engine.

11. Security And Confidentiality-

As a part of the AES (Advanced Encryption Standard), the encryption key should be of at least 128 bits. Reputed application developers use the pinning certificate and the hash key to support the security. It incorporates the returning of the complete request, that appears as a hashed string with a secret key. This string is compared by the server with request that it gets, verifying any modification or change in the process.

Some Other Security Measures-

Most of the security issues are due to issues during the development and configuration of android apps. For this, 

  • Integrate security teams upstream, do a risk analysis and set up mobile security management approach on the project.
  • Identify the essentials concerning personal data protection
  • Identify relevant security standards and regulations
  • Analyse and monitor deployments of antivirus and firewalls on the phone that control illegal installation of code on device.
  • Use architecture standards of QWASP
  • For critical apps in sensitive locations, consider deploying a biometric authentication
  • Perform regular code reviews and in-depth audits
  • Customize factory default settings

Wrap Up-

Security of applications plays an important role in the app success, so knowing the above tips to secure the android app will help you to develop a secured app. There can be some other security measures too. If you are thinking of developing a secured android app, consult with solace experts. We are here to help you through consultation and development. You can hire android developers of the Solace team on a flexible basis for app development according to your business requirements. Connect with Solace and get a free quote for android app development. We will be happy to help you. 


Wednesday, October 2, 2019

8 Cool Tips to Enhance Your Mobile App Security

Mobiles enable us to do about everything on the web—from anyplace, whenever. We can do our banking work, track our wellness, control Internet of Things gadgets in our homes, shop, and also much more work remotely. Driving this mobile productivity are a huge number of versatile applications- software that interface with APIs and servers around the globe to deliver data, services, and, at last, value and convenience to users. But this all has to happen under a mask of  well- designed security or organizations hazard endangering their applications, their very own framework, their clients’ data, and their reputations. Because where digital activity increases, hackers are also there.
Applications and mobile devices are huge focuses for noxious action. Analysis of app security reported that 90% of apps had at least 2/10 of major security risks. Near about 50% of organizations have not designed any security towards mobile apps, a really enormous inconsistency when you consider the dangers of not securing a mobile application. 

What hackers does?

  • Infuse malware into apps and onto devices where it can access data, store keystrokes, and steal screen lock passcodes.
  • Duplicate your application’s code and also figure out a parody application containing malware.
  • Capture delicate data going over the wireless transmissions
  • Take client information for data fraud or extortion purposes
  • Get hold of protected innovation and private business resources
  • Access your IP or compromise your organization’s back-end network
Mobile applications and APIs that power them can possibly make frameworks and information defenseless on the off chance that they aren’t appropriately secured. Users expect applications to be secure and it very well may be anything but difficult to underestimate that trust. For the applications that deal with large amount of data like finance or healthcare, this is true.

What Can You Do To Secure Your Mobile App?

1. API Security-

Mobile applications interact with each other through API (Application Programming Interface). The APIs are vulnerable to attack by attackers. Hence it is necessary to secure them. To avoid such attacks, use authorized APIs in the app’s code. Every application must receive an API key to interact with the platform you are working on. Inserting an API gateway is another progression that designers pursue to increase the security. Directing code surveys or including a firewall for web applications is another way to stay away from attacks by hackers.
Using API keys, you can build a safe and secure API. As a mobile app developer  you can analyze use and metrics with an API key. There is one advantage of using them is that- you can get built-in analytics. API keys are a necessity but they are not only the security measures. If keys to locks get lost or get stolen, a challenge may arise. This is where authentication makes that big appearance. With the use of tokens and 2 factor authentication, you can authorize apps to collect data.

2. Secure network connection-

Servers and cloud servers that an application’s APIs are getting to, ought to have safety measures set up to secure data and prevent unauthorized access. APIs should be verified to prevent eavesdropping on delicate data going from the customer back to the application’s server and database.

Tips:

  • Containerization- It  is a method of creating encrypted containers for securely storing your data and documents.
  • Counsel a network security specialist to conduct penetration testing and vulnerability evaluations of your system to guarantee the correct information is ensured in the correct ways.

3. Secure Your App’s Code-

As software project needed a security, mobile software also needs to be secured. Native apps are not the same as web applications, where data and software exist securely on a server and the client-side is an interface. With native apps, code dwells on the device once it is downloaded. This makes it more accessible to those with malicious aim. Numerous vulnerabilities can exist in an application’s source code, yet that is not where organizations focus their security spending. Network and data security components are are significant parts of the general security picture, yet security needs to begin with the application itself. Vulnerabilities can be brought about by developers’ mistake, inability to test the code, or your application may simply be focused on explicitly by a hacker.

Tips:

  • Use encryption to protect the app. You need to keep the code secret and also difficult to read. Jumbling and minification are basic measures, yet they’re insufficient. Stick with moders and well-supported algorithms combined with API encryption.
  • Test code for vulnerabilities
  • Solidified, secure application code should be portable among devices and operating systems, and be anything but difficult to fix and update. You don’t need clients stuck without an update after a break, so make a code to be as agile as possible.
  • Consider the things like file size, runtime memory, performance and battery usage when adding security to app. You need it to be secure, yet not at the expense of execution and client experience.

4. Put Identification, Authentication, And Authorization Measures In Place-

Authentication and authorization help users demonstrate to an application who they are, adding another layer of security to the login procedure.

Tips:

  • You should take extra caution if your app is depend on someone else’s API for functionality. Ensure that APIs that your app uses allows access to the parts of your app that are required to minimize vulnerability. 
  • OAuth2 has turned into the best quality level protocol for managing secure connections via user-specific, one time tokens.Installing this framework on your authorization server allow you to grant user permissions between the client and end users.
  • OpenID Connect is a protocol that allows users to reuse their same credentials with multiple domains with an ID token. So they don’t have a need to register and sign in at each point.

5. Implement A Good Mobile Encryption Policy-

As mentioned above, more of a mobile app’s code and data has to be stored on a device than with a traditional web app because you’re representing the varying performance, bandwidth, and quality of devices. If data stored locally on a device is more, then there will be more vulnerability. Defective apps can leak customer data without users knowing it.

Tips:

  • File-level encryption protects data on a file-by-file basis. It is a way to encrypt at-rest data so it cannot be read if intercepted.
  • Encrypt mobile databases. 
  • Design apps so that very sensitive customer data like passwords, credit card data etc. stored directly on a device. Ensure that this data stored there is secure.

6. There’s no limit to testing your application-

Testing of an app includes examining the data security issues, session management with authentication and authorization. Create test cases according to threats and challenges.  These experiments should cover each OS version and phone models.

Tips to help in testing the security of your app:

  • Guarantee that all the application log documents don’t store the authentication tokens.
  • Check whether the drivers can see information according to their rights.
  • For web service, check the encryption of login authentication token.
There are many security testing tools to analyze the security of your mobile app. For eg., iPad File Explorer, QARK, Clang Static Analyzer, Smart Phone Dumb Apps.

7. Users: Protect Your Devices-

App developers can not do a great deal to guarantee clients have secure devices. But here are some points to follow for users to avoid security issues.

Tips:

  • Try not to use a jailbroken or rooted device. This removes the security measures the device comes with and you’re left more vulnerable as a result.
  • Download applications only from trusted sources such as authorized app stores.

8. If You’re An Enterprise Organization With A Byod (Bring Your Own Device) Policy, Use Extra Caution-

For organizations that enable employees to utilize their very own devices, this can likewise open up the system to hacking vulnerabilities and make it harder for the IT office to manage access to information on their backend systems. These can give employees the comfort of working, yet additionally give organizations genuine feelings of serenity with regards to security.

Tips:

  • Block unauthorized devices, and secure cleared devices with firewall, antivirus, and anti-spam software
  • Make devices “risk-aware” so that applications endeavoring to make certain transactions are hindered from doing so. Applications can be coded to distinguish and obstruct certain transactions from rooted devices.
  • Implement a VPN to create a secure connection.
You can also know best mobile app development trends at- Best Mobile App Development Trends in 2019.

Conclusion-

Securing your mobile app is an important thing.  It is equally important to stay updated with the latest tools and techniques revolving around cybersecurity to further shield your app. Similarly, keep track of malpractices by attackers for data breaches and threats. The best part about above-discussed methods is that they are quick and easy to implement.
Are you looking to develop effective mobile app for your business? Solace developers are expert in app development and also app security trends. Dedicated team will help you to develop and secure effective and interactive mobile apps. Contact us for mobile app development that will be the face of your successful business.